PermissionsEx

PermissionsEx

14M Downloads

Calling getPermissionValue for a user returning wrong results

bloodmc opened this issue ยท 1 comments

commented

Using PEX build 131 for 1.8.9

    public static Tristate getUserPermission(User user, Claim claim, String permission, Context sourceContext) {
        Set<Context> contexts = new HashSet<>();
        if (claim.parent != null) {
            contexts.add(claim.parent.getContext());
        } else {
            contexts.add(claim.getContext());
        }

        if (sourceContext != null) {
            contexts.add(sourceContext);
        }

        // This is required since permissions will check each context separately
        if (!user.getSubjectData().getPermissions(contexts).isEmpty() || !user.getSubjectData().getParents(contexts).isEmpty() ) {
            // This is always returning true
            Tristate value = user.getPermissionValue(contexts, permission);
            if (value != Tristate.UNDEFINED) {
                return value;
            }
        }
        return Tristate.UNDEFINED;
    }

Using the following context against user with UUID "bc1b308c-166f-3e68-8227-125e03c80d18"

"gp_claim": "92d8a0fb-6890-481c-b615-633b2efdb62f"

The first permission that I check for is "griefprevention.claim.flag.interact-block-secondary.minecraft.ender_chest" which returns TRUE and is correct.
The second permission that is checked is "griefprevention.claim.flag.interact-block-secondary" and this seems to return TRUE as well which is wrong. I even set all occurences of "griefprevention.claim.flag.interact-block-secondary" to -1 and reloaded PEX with the issue still happening.

I even tried the following method which also returned TRUE when it clearly should be UNDEFINED

user.hasPermission(contexts, "griefprevention.claim.flag.interact-block-secondary");

Entire permission file can be found here

http://pastebin.com/E6MS8EyW

commented

nevermind, the user had

"griefprevention.claim": 1,

derp...