Permissions API

I’m trying to figure out how to work with the permissions api, not really sure where to start and there’s no documentation yet, does anyone know if it’s even implemented yet? if it has been implemented can someone help me out with it?

My best guess is this is what I need to work with? I’m just not sure how it works.

thanks but not exactly what I’m looking for, I’ll ad a link to something I found in my OP

@patey

Permissions is implemented. What are you needing help with?

1 Like

The major interface here is Subject.

All players, consoles, etc will extend Subject.

From here you can do subject.hasPermissions(String perm) to check a permission in the current context (eg what world they’re in).

You can check what groups they’re a part of by calling subject.getParents() - all groups are themselves subjects which can have permissions etc.

2 Likes

@Zidane Basically I’m trying to do PEX in sponge but on a smaller scale for a personal server. I think I get what @ZephireNZ explained there but how would I store this info? In a .conf file similar to how bukkit perm plugins use to store it in a .yml?

You are probably already aware but Pex is updated/updating for sponge, https://github.com/PEXPlugins/PermissionsEx/blob/master/src/main/java/ninja/leaping/permissionsex/sponge/PermissionsExPlugin.java

Not sure if you can get much information from that.

You will need to implement PermissionService and register it with sponges Service API.
https://docs.spongepowered.org/en/plugin/advanced/services.html

You also might be able to get a little insight from reading the comments on the following closed/accepted pull request.

You will also likely need to implement ContextCalculator if you wish to do per world / region / minigame / othercontexthere permissions

https://github.com/SpongePowered/SpongeAPI/blob/master/src/main/java/org/spongepowered/api/service/permission/context/ContextCalculator.java

1 Like

thanks @ryantheleach I didn’t know PEX was already so far along in converting. I think I’ll use that rather than make my own, a permissions plugin may be more work than I can take on right now.