šŸ”‘ PermissionsEx v2.0 [API 5]

Tab completion should work – check back after I make some changes to Sponge’s tabcompletion handling and see if it works then

Well yes… PEX2 has a completely different API. For the most part, you do want to use the PermissionService provided with Sponge and not depend directly on PEX – it allows access to pretty much everything available directly and is more stable. Just access it like so:


@Plugin([...])
public class MyPlugin {
    private PermissionService perms;
    @Listener 
    public void onServiceChange(ChangeServiceProviderEvent event) {
        if (event.getNewProvider() instanceof PermissionService) {
            perms = (PermissionService) event.getNewProvider();
        }
    }

    public void doAThing(Player p) { // players are already Subjects, 
    // so for online players you can skip the perms.getUserSubjects().get(...) part
        perms.getUserSubjects().get(p.getUniqueId().toString()).getSubjectData().setPermission(SubjectData.GLOBAL_CONTEXT, "my.perm", Tristate.TRUE);
    }
}

You don’t even need to keep track of the PermissionService if you only need to deal with online players – just access the Subject methods like ply.getSubjectData() to change attributes.

3 Likes

Good to know, i will try to list the perms of player with your example.
Thanks.

Hello,

I’m struggeling to create a default user group without any permissions.
This is my .json file:
permissions.json
The default user group inherits from the group ā€œDefaultā€, to check that I’m realy in this group I have added a namecolor.

This deletes most of the command when I’m using /help but some are still remaining:
/help
But I want to delete all commands, how can I do it?

Best regards

Somehow I managed to remove the permission for reloading pex from the server console :fearful:

…

And even worse:
pex reload
[08:51:39] [Server thread/INFO]: You do not have permission to use this command!
[08:51:39] [Server thread/INFO]: Usage: /pex [ranking|[–context|–contexts|-c] [-transient] subject permission-default|delete|options|info|permission|parents|[-transient] subject-type list [filter]]
say SERVER REBOOT IN 10 SECONDS!
[08:55:31] [Server thread/INFO]: You do not have permission to use this command
save-all
[08:55:41] [Server thread/INFO]: You do not have permission to use this command
stop
[08:55:51] [Server thread/INFO]: You do not have permission to use this command

Now pex is preventing me from stopping the server nicely, and forcing me to do kill -9 :sob:

This was less than amusing.

Seems that this part of the config is quite important :wink:

        "default": [
            {
                "contexts": {
                    "srcip": "127.0.0.1"
                },
                "permissions-default": 1
            }
        ]

Progress :slight_smile: Remaining problem now is that I’d like the group ā€œDefaultā€ to hold permissions for everybody that have not been explicitly added to a group - or some other way of adjusting default permissions. This stanza doesn’t seem to work as intended:

   "system": {
        "default": [
            {
                "parents": [
                    "group:Default"
                ]
            }
        ]
    },

Anybody?

Then just add all your perms for defaults to the group ā€œDefaultā€

Can someone PLEASE tell me what is wrong with my permissions. it says that they are all good in the parser, but in-game I cannot use most commands. I am in the ā€œownerā€ category and cannot break any blocks in an admin claimed area (safezone) but i can claim for the safezone. i have no idea what is happening so if anyone can help, it would be greatly appreciated. http://pastebin.com/zPPnCBqP

all perms from line 374-485 are set to -1 and so is 487

1 Like

OHHHH im so stupid omg thank you so much

no problem @LebrownJames

1 Like

Myself and @Peav have been building a server and for the last few version updates we’ve been running into circular inheritance issues.

We are 110% sure it is an issue with our permission file. Even with no mods other then pex and sponge we still get the error.

This is the console output:

[01:55:37] [Server thread/WARN] [PermissionsEx]: Potential circular inheritance
found while traversing inheritance for user=*****-5ba5-4e46-b70e-4ab0dbac0c91
when visiting group=Noobs

Here is our perms file:
PasteBin

This is built from this template made by @MoeBoy76.

Any help with this issue will be repaid with digital high fives!

forge-1.8.9-11.15.1.1722-universal
spongeforge-1.8.9-1722-3.1.0-BETA-1115

As of the latest version (no ver. numbers, sorry) commands to not appear to function. With any more than no arguments the server returns ā€œtoo many argumentsā€

I believe the problem os that your Default group inherits from Noobie, while every group inherits from Default. If I’m right, they will inherit from each other in an infinite loop :slight_smile:

2 Likes

Not exactly circular inheritance in this case – it’s more like a group appearing multiple times in this case – so remove Noobs from inheritance or just ignore it.

2 Likes

I miss the yml but I feel that this is a more powerful system. More control over inheritance, just a wee bit harder to understand! We’ll figure it all out eventually.

1 Like

Digital High Five! :wave:

3 Likes

Would it be possible to add two mechanics in the next version?

  • Teleport cooldown (Player can’t teleport again until the cooldown is 0, cooldown-time configurable in the config file)
  • Teleport not possible during fight or while the player is moving
    This would be very nice :slight_smile:
1 Like

Can someone PLEASE tell me what’s wrong with my permissions. PermissionsEx crashed every time i use this permission file: http://pastebin.com/UNBfr4tQ

you were missing an end quote on your invalid homes permission for the Karp group, try using a JSON parser if you aren’y going to actually follow the recommendation for using in-game commands (ie the only supported way to set permissions), for ease i have fixed it, see this gist: