Supporting different Permissions

Discussion in 'Plugin Development' started by LRFLEW, Aug 11, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    LRFLEW

    I am finally at a situation where I need to add permission nodes to my plugin. I know how to hook into plugins, but I really don't know where to start to actually use permissions. I know bukkit has new built in permission system, but I don't know wither or not to use it, and if that's enough. What plugins should I hook into? Should I (or should I not) use bukkit's built in? I know there's more than one solution for permissions, and if someone is using multiple permission systems (like WorldEdit and others have built in ones, but they might use Permissions regularly for the other plugins) which should I prioritize first, and is it an AND or OR system? Please help :p
     
  2. Offline

    thehutch

    Well if your a noob like me then start with bukkitPermissions its much easier to use than the others. Otherwise go with a popular one
     
  3. Offline

    LRFLEW

    I could, but I'm aiming for maximum compatibility with people's existing permissions setup, and I don't think anybody uses bukkit's setup :p
     
  4. Offline

    thehutch

  5. Offline

    NuclearW

    player.hasPermission("some.permission.node");
     
  6. Offline

    thehutch

    I don't think thats what he means, he means which permissions should he choose to support.
     
  7. Offline

    NuclearW

    Use that and you support anything which supports the built-in superperms API.
     
  8. Offline

    s1mpl3x

    personally i use permissions 3 as default with a fallback to OP and added a option in the config to use bukkits permissions instead of the permissions plugin. I think this is a good way to go and it's not that hard to implement. But yea you should at least support Bukkits permissions API since the permission plugins will support that api sooner or later
     
  9. Offline

    LRFLEW

    I'm looking to support ALL I CAN. Does the popular permissions plugins support it (such as theYeti's)?
     
  10. Offline

    Nitnelave

    you could have a method like checkPermissions(player, node) in which you try with theYeti's Permissions if you've found it, then (maybe a setting in the config) bukkitPerms or OP system. Everything else pretty much has a bridge to theYeti's permissions.
     
  11. Offline

    SpaceManiac

    PermissionsBukkit, bPermissions, and PermissionsEx all support the player.hasPermission method; although Permissions 2.7 does not support it (and never will, since it is outdated) and neither does Permissions 3.x (which doesn't yet but really ought to) do not, it is considered good practice to use the built-in permissions system when developing new plugins.
     
  12. Offline

    Zarius

    I understand the want to support older versions though - Permssions 2.7 is still very popular and many of the plugins (I'm running over 70) I use do not yet support the newer permissions system (in fact I only setup the new PermissionsBukkit plugin last night for the first time as a newer plugin required it).

    @LRFLEW

    Take a look at the OtherBlocks source code if you want some an example of supporting Permissions 2.7 (which should automatically work with Permissions 3 & works with EssentialsGroupBridge - should work with SuperPermsBridge too I think, haven't tested this).

    Will be looking at added official BukkitPermissions support soon in conjunction with retaining support for Permissions 2.7 - will likely add a custom "permissionshandler" wrapper that I call from my code. The custom wrapper will check a variable (set at onEnable after detecting which permissions are installed) and send the appropriate function calls.
     
  13. Offline

    Unlucky4ever

    Nevermind
     
  14. Offline

    LRFLEW

    Sorry to extend a current thread with a new question, but how do I add layered permissions in the plugin.yml file for the default permissions? And how do I change the default behavior (like true, false, op, notop as described in the posting for it)?

    oh and btw, I already got Permissions 3.x setup by the time you posted that by copying and pasting most of the code form the now worthless iConomy API tutorial

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 18, 2016
  15. Offline

    Unlucky4ever

    I didn't copy paste that from iConomy, is that what it really looks like? Lol, never knew that.
     
  16. Offline

    LRFLEW

    it's not what it looks like. In fact that way involves PluginEnableEvent and PluginDisableEvent, which I think is suppose to be better :p
     
  17. Offline

    Unlucky4ever

    Yea plus I like to have a visual saying it actually found the permissions, I've noticed not a lot do that lol...
     
  18. Offline

    EdTheLoon

    Currently I'd say you're best off supporting SuperPerms AND Permissions (2.7 or 3.x). I used a config to let users tell the plugin which to use rather than assume. For checking permissions you're best to make a function (I'd suggest putting this in a seperate class) that returns true or false and has the correct way of hooking into each permissions system and returning a value. You can look at my projects source if you want as it has lots of line comments that ought to help.
     
Thread Status:
Not open for further replies.

Share This Page