[ADMIN/DEV] PermissionsEx

Discussion in 'WIP and Development Status' started by t3hk0d3, Apr 17, 2011.

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

    t3hk0d3

    Plugin are now in Releases. Please discuss here:
    http://forums.bukkit.org/threads/ad...-v1-0-100-permissions-extended-733-798.18140/

    PermissionsEx are fork of famous Permissions plugin. I send to scrap all original code and rewrote it from scratch.

    GitHub:
    https://github.com/t3hk0d3/PermissionsEx
    https://github.com/t3hk0d3/PermissionsCompat

    Development talk:
    #PermissionsEx on irc.esper.net

    Features:
    • Completely new implementation supporting several backends - SQL and YAML backend implemented, but you can easly write your own backend (ie XML or even NBT :) )
    • New rich console/chat configuration interface, now you can change permissions on the fly. You can change almost every option (even backend) right from the chat interface.
    • New, more flexible internal architecture. There is no more code mess. Also powerful API provided, which touches almost every aspect of system.
    • Compatibility layer with Permissions provided - in most cases you don't need to rewrite your plugin.
    • New YAML (File) backend, fully rethinked config structure - more easy and human understandable. All options stay in one config file instead of several files.
    • And finally, most delicious, SQL backend. This was the main reason to start making this plugin.
      MySQL and SQLite currently supported.
    • Write your own permissions backend through your own plugin (API available)
    Current TODO:
    • Testing testing testing
    • DOCUMENTATION - there is not documentation at all. I will be very appreciated for help, since my english are not good at all. I made all this text with with great difficulty, trust me :)
    Available commands:
    Code:
     Usage:
    /pex - Display help
    /pex reload - Reload configuration
    /pex hierarhy - Print complete user/group hierarhy
    /pex backend - Print currently using backend
    /pex backend <backend> - Change permission backend on the fly (Use with caution!)
    
    /pex users - Print registred user list (alias)
    /pex users list - Print registred user list
    
    /pex groups - Print registed group list (alias)
    /pex groups list - Print registred group list
    
    /pex user <user> - List all user permissions
    /pex user <user> list - List all user permissions
    /pex user <user> group list - List all user groups
    /pex user <user> prefix [newprefix] - Print current user's prefix. Specify newprefix to set prefix.
    /pex user <user> suffix [newsuffix] - Print current user's suffix. Specify newsuffix to set suffix.
    /pex user <user> add <permission> [world] - Add permission to user
    /pex user <user> set <permission> <value> [world] - Set permission setting to given value
    /pex user <user> remove <permission> [world] - Remove permission from user
    /pex user <user> group add <group> - Add user to specified group
    /pex user <user> group set <group> - Set only group for user (remove from others)
    /pex user <user> group remove <group> - Remove user from specified group
    
    /pex group <group> - List all group permissions (alias)
    /pex group <group> list - List all group permissions
    /pex group <group> user list - List all group user permissions
    /pex group <group> prefix [newprefix] - Print current group's prefix. Specify newprefix to set prefix.
    /pex group <group> suffix [newsuffix] - Print current group's suffix. Specify newsuffix to set suffix.
    /pex group <group> create [parents] - Create group, optionally set parent groups by comma-separated list
    /pex group <group> delete - Removes group
    /pex group <group> parents - List all group parents (alias)
    /pex group <group> parents list - List all group parents
    /pex group <group> parents add <parents> - Set parents by comma-separated list
    /pex group <group> parents remove <parents> - Set parents by comma-separated list
    /pex group <group> add <permission> [world] - Add permission to group
    /pex group <group> set <permission> <value> [world] - Add permission for group
    /pex group <group> remove <permission> [world] - Remove permission from group
    /pex group <group> user add <users> - Add users (one or comma-separated list) to specified group
    /pex group <group> user remove <users> - Add users (one or comma-separated list) to specified group
    Suggested API example:

    Code:
    if(Bukkit.getServer().getPluginManager().isPluginEnabled("PermissionsEx")){
        PermissionManager permissions = PermissionsEx.getPermissionManager();
    
        // Permission check
        if(permissions.has(player, "your.plugin.namespace.permission")){
        // yay!
        } else {
        // houston, we have a problems :)
        }
    } else {
       Logger.getLogger("Minecraft").warning("PermissionsEx plugin are not found.");
    }
    Also original Permissions API are available through Compatibility Layer
    https://github.com/t3hk0d3/PermissionsCompat

    There is also Advanced API, which will be described in documentation.

    I will be very grateful for any advices and suggestions
     
    lycano likes this.
  2. Offline

    shadrxninga

    Make an alias for /permissions like /pr - it could be a pain to have to type out /permissions every time you wanted to use it.
     
  3. Offline

    t3hk0d3

    Already did :)
     
  4. Offline

    Killie01

    is this for plugin developers?
     
  5. Offline

    lycano

    @t3hk0d3: This is exactly what this thing needs ^^ But .. I would be grateful if you have had forked the Permissions Plugin on github as this is obviously a fork since the README and the topic didn't changed at all and contains an compatibility interface for the current Permissions Plugin.

    Despite the fact you've done some really clean coding... we don't need another Permissions Plugin we need one working and easy to use interface with an sqlite / mysql / filebased backend.

    I would suggest you fork the current permissions plugin from TheYeti Permissions on Github. Create a remote upstream and then import your project into your forked master branch. Furthermore you could chat with them on esper.net and ask for a code review and later for a pull. I think they will accept a pull if this is really working as it seems.
     
  6. Offline

    TheYeti

    Yea, it would have been nice to have you work with me instead of going off on your own trying to make yet another Permissions plugin that the community doesn't need. As Lycano said, we need a single Permissions plugin that works better. I have been working on such, but it seems like you are well ahead of me on that. So a fork and pull request would have been nice.
     
  7. Offline

    t3hk0d3

    Thank you. I'm not familiar with the github, so thank you for advise. I will certanly do as you described, but at first i want reach planned features and some point of stability, then forking, merging or whatever. But at this point i want develop this plugin sole, but when i reach my some goals (features, stability level, etc) and will be not afraid about future of plugin (i afraid side interference, just don't wont argue about controversial commits), and then i would be happy to elaborate together with community. Today i just want to focus only on actual development, not on negotiations stuff. Althought i would be grateful for actual code review (but keep in mind about "WIP" :) Stuff can change in moment you read code, API not freezed at all )

    I hope for appreciation (is it right word?)

    README file are my glich :) Just WIP and README turn not yet come.
    And actually there is not much code left from original, almost everything was rewritten from scratch. Only code, which removal may cause compatibility issues, left.
    Compatibility are left only on API level. Configs are different.
    There also some authorship issues.

    Plugin Developers and Server administrators

    Thank you, but at first i just want finish bulk part of work at first :) You can contact with on Skype, just look for "clouster". That would be nice to work together althought.
    PS/I made this on last weekend, that was rush. I was working like a mad :D

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

    rcjrrjcr

    Admittedly, the current structure of Permissions is extremely messy now. Maybe you could come and help to rewrite some parts of Permissions? Join #permissions on Esper if you can, so that we can discuss stuff there.
     
  9. Offline

    t3hk0d3

    Updated commands list (featuring several new one)
    Also base command implementation are finished. Implement actual command actions left only.

    Ummm... what sense to rewrite parts when i've already got almost finished new plugin? You missed a long and hard conversation in IRC yesterday .

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

    lycano

    @t3hk0d3: I wonder what you have talked about after switching to russian charset ;)
     
  11. Offline

    rcjrrjcr

    ...
    Either I'm slow, or that conversation happened when I was sleeping (timezones).
     
  12. Offline

    t3hk0d3

    [offtop] About politics, culture, language, sense of life, such cases :D[/offtop]
     
  13. Offline

    t3hk0d3

    Plugin are in stabilization (testing and debugging) stage, all planned features are implemented.

    Also command list updated
     
    lycano likes this.
  14. Offline

    lycano

    awesome!
     
  15. Offline

    t3hk0d3

    Plugin are in prerelease.
    just lack of documentation :(
    Im too lazy even to write README :)
     
  16. Offline

    Joy

    This is great, I am hoping for a release soon, or even anything decent to use :p
     
  17. Offline

    ks07

    I am getting excited about this, so before the sh*tstorm of haters breaks in about Permissions... keep up the good work. :D
     
  18. Offline

    Joy

    Is this dead? :S
     
  19. Offline

    lycano

    As far as i know its not ^^ Because this is a huge project and run by only one man currently it could take a while to reach productional stage. Which means its on testing currently.
     
  20. Offline

    t3hk0d3

    No, everything almost ready for release, im just struck at writing README file :)
     
  21. Offline

    Abadon84

    works for me with mysql backend, nice work ;)
    only groups must set up manually and it throws some warnings, but nothing critical.
    for the guys who search the permission nodes for pex (like me yesterday XD ):
    Code:
    [World]
    
        permission = "modifyworld.destroy",
        description = "Let the user destroy blocks")
    
        permission = "modifyworld.place",
        description = "Let the user place Blocks")
    
    [Permissions Ex]
    
        pex reload,
        permission = "permissions.manage.reload",
        description = "Reload permissions")
    
        pex backend,
        permission = "permissions.manage.backend",
        description = "Print currently using backend")
    
        pex backend <backend>,
        permission = "permissions.manage.backend",
        description = "Change permission backend on the fly (Use with caution!)")
    
    [User management]
    
        pex users list,
        permission = "permissions.manage.user",
        description = "List all registred users")
    
        pex users,
        permission = "permissions.manage.user",
        description = "List all registred users (alias)")
    
        pex user,
        permission = "permissions.manage.user",
        description = "List all registred users (alias)")
    
    [User's permissions management]
    
        pex user <user>,
        permission = "permissions.manage.user.permissions",
        description = "List user permissions (list alias)")
    
        pex user <user> list [world],
        permission = "permissions.manage.user.permissions",
        description = "List user permissions")
    
        pex user <user> add <permission> [world],
        permission = "permissions.manage.user.permissions",
        description = "Add permission to user")
    
        pex user <user> set <permission> <value> [world],
        permission = "permissions.manage.user.permissions",
        description = "Set permission setting to given value")
    
        pex user <user> remove <permission> [world],
        permission = "permissions.manage.user.permissions",
        description = "Remove permission from user")
    
    [User's groups management]
    
    
        pex user <user> group list,
        permission = "permissions.manage.membership",
        description = "List all user groups")
    
        pex user <user> group add <group>,
        permission = "permissions.manage.membership",
        description = "Add user to specified group")
    
        pex user <user> group set <group>,
        permission = "permissions.manage.membership",
        description = "Set leave specified group for user")
    
        pex user <user> group remove <group>,
        permission = "permissions.manage.membership",
        description = "Remove user from specified group")
    
    [Group management]
    
        pex groups list,
        permission = "permissions.manage.group,
        description = "List all registred groups")
    
        pex groups,
        permission = "permissions.manage.group,
        description = "List all registred groups (alias)")
    
        pex group,
        permission = "permissions.manage.group,
        description = "List all registred groups (alias)")
    
        pex group <group> create [parents],
        permission = "permissions.manage.group.create",
        description = "List all group permissions (alias)")
    
        pex group <group> delete,
        permission = "permissions.manage.group.remove",
        description = "Removes group")
    
    [Group inheritance]
    
        pex group <group> parents list,
        permission = "permissions.manage.group.inheritance",
        description = "Set parents by comma-separated list")
    
        @Command(name = "pex",
        syntax = "group <group> parents set <parents>",
        permission = "permissions.manage.group.inheritance",
        description = "Set parents by comma-separated list")
    
    [Group permissions]
    
        pex group <group>,
        permission = "permissions.manage.group.permissions",
        description = "List all group permissions (alias)")
    
        pex group <group> list [world],
        permission = "permissions.manage.group.permissions",
        description = "List all group permissions")
    
        pex group <group> add <permission> [world],
        permission = "permissions.manage.group.permissions",
        description = "Add permission to group")
    
        pex group <group> set <permission> <value> [world],
        permission = "permissions.manage.group.permissions",
        description = "Set permission value for group")
    
        pex group <group> remove <permission> [world],
        permission = "permissions.manage.group.permissions",
        description = "Remove permission from group")
    
    [Group users management]
    
        pex group <group> users,
        permission = "permissions.manage.membership",
        description = "List all group users")
    
         pex group <group> user add <user>,
        permission = "permissions.manage.membership",
        description = "Add users (one or comma-separated list) to specified group")
    
        pex group <group> user remove <user>,
        permission = "permissions.manage.membership",
        description = "Add users (one or comma-separated list) to specified group")
    and here the pex-config for the mysql backend:
    Code:
    permissions:
        backends:
            sql:
                driver: mysql
                uri: mysql://localhost/database
                user: user
                password: password
        backend: sql
        basedir: plugins/PermissionsEx
    here some suggestions for the db structure: use unique ids as indexes, so the tables are clear and you can use this ids instead of the full names in other tables. i think it would be better to seperate user table and entity table from inheritances and make a own user table with unique ids. you can use the ids from the entity table and the user table in inheritance then and could provide some extra options for the users.
    in the moment i do so and let the plugin work with the joined views, it saves memory and keep it clear ;)

    here a migrade script from yeti permissions to pex mysql (you have to edit the database and path variables in the top): http://procrafter.de/downloads/yeti2pex_sql.pl
    i think tomorrow i post a live translator from yaml to sql statements ;)

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

    Phaedrus

    This is great and all, but what is going to happen when bukkit's default permissions come out? @sk89q post about the impending bukkit permission system kind of made it sound like alternatives wouldn't be possible initially.
     
  23. Offline

    Abadon84

    at the moment this is better than the current state of the build in ;)
     
  24. Offline

    t3hk0d3

    Now we are supporting SQLite. There need more testing, but im sure most of functionality should work.
    You just need to set "permissions.backends.sql.driver" to "sqlite" and change "permissions.backends.sql.driver" to something like "sqlite:<yourdatabasename>" in config.yml. PEX will take care about everything else (like schema deployment).

    MySQL database schema are now deployed automatically, so there is no need anymore to upload dump to database manualy.

    Also there are plenty of improvements which aren't displayed there: modifyworld permission set (ie modifyworld.entity.damage.deal) and much more.
     
  25. Offline

    Abadon84

    here the new permission nodes:
    Code:
    [World]
    
    "modifyworld.blocks.destroy",
    "modifyworld.blocks.place",
    "modifyworld.blocks.interact",
    "modifyworld.vehicle.destroy",
    "modifyworld.vehicle.enter",
    "modifyworld.vehicle.collide",
    "modifyworld.entity.damage.deal",
    "modifyworld.entity.damage.take",
    "modifyworld.entity.mobtarget",
    "modifyworld.usebeds",
    "modifyworld.bucket.empty",
    "modifyworld.bucket.fill",
    "modifyworld.chat",
    "modifyworld.items.drop"
    "modifyworld.items.pickup.*" for all itmes or "modifyworld.items.pickup.itemid" for specific item
    
    [Permissions Ex]
    
        pex reload,
        permission = "permissions.manage.reload",
        description = "Reload permissions")
    
        pex backend,
        permission = "permissions.manage.backend",
        description = "Print currently using backend")
    
        pex backend <backend>,
        permission = "permissions.manage.backend",
        description = "Change permission backend on the fly (Use with caution!)")
    
    [User management]
    
        pex users list,
        permission = "permissions.manage.user",
        description = "List all registred users")
    
        pex users,
        permission = "permissions.manage.user",
        description = "List all registred users (alias)")
    
        pex user,
        permission = "permissions.manage.user",
        description = "List all registred users (alias)")
    
    [User's permissions management]
    
        pex user <user>,
        permission = "permissions.manage.user.permissions",
        description = "List user permissions (list alias)")
    
        pex user <user> list [world],
        permission = "permissions.manage.user.permissions",
        description = "List user permissions")
    
        pex user <user> add <permission> [world],
        permission = "permissions.manage.user.permissions",
        description = "Add permission to user")
    
        pex user <user> set <permission> <value> [world],
        permission = "permissions.manage.user.permissions",
        description = "Set permission setting to given value")
    
        pex user <user> remove <permission> [world],
        permission = "permissions.manage.user.permissions",
        description = "Remove permission from user")
    
    [User's groups management]
    
    
        pex user <user> group list,
        permission = "permissions.manage.membership",
        description = "List all user groups")
    
        pex user <user> group add <group>,
        permission = "permissions.manage.membership",
        description = "Add user to specified group")
    
        pex user <user> group set <group>,
        permission = "permissions.manage.membership",
        description = "Set leave specified group for user")
    
        pex user <user> group remove <group>,
        permission = "permissions.manage.membership",
        description = "Remove user from specified group")
    
    [Group management]
    
        pex groups list,
        permission = "permissions.manage.group",
        description = "List all registred groups")
    
        pex groups,
        permission = "permissions.manage.group",
        description = "List all registred groups (alias)")
    
        pex group,
        permission = "permissions.manage.group",
        description = "List all registred groups (alias)")
    
        pex group <group> create [parents],
        permission = "permissions.manage.group.create",
        description = "List all group permissions (alias)")
    
        pex group <group> delete,
        permission = "permissions.manage.group.remove",
        description = "Removes group")
    
    [Group inheritance]
    
        pex group <group> parents list,
        permission = "permissions.manage.group.inheritance",
        description = "Set parents by comma-separated list")
    
        syntax = "group <group> parents set <parents>",
        permission = "permissions.manage.group.inheritance",
        description = "Set parents by comma-separated list")
    
    [Group permissions]
    
        pex group <group>,
        permission = "permissions.manage.group.permissions",
        description = "List all group permissions (alias)")
    
        pex group <group> list [world],
        permission = "permissions.manage.group.permissions",
        description = "List all group permissions")
    
        pex group <group> add <permission> [world],
        permission = "permissions.manage.group.permissions",
        description = "Add permission to group")
    
        pex group <group> set <permission> <value> [world],
        permission = "permissions.manage.group.permissions",
        description = "Set permission value for group")
    
        pex group <group> remove <permission> [world],
        permission = "permissions.manage.group.permissions",
        description = "Remove permission from group")
    
    [Group users management]
    
        pex group <group> users,
        permission = "permissions.manage.membership",
        description = "List all group users")
    
         pex group <group> user add <user>,
        permission = "permissions.manage.membership",
        description = "Add users (one or comma-separated list) to specified group")
    
        pex group <group> user remove <user>,
        permission = "permissions.manage.membership",
        description = "Add users (one or comma-separated list) to specified group")
     
  26. Offline

    ToastedJelly

    I don't get it. Is this functionality not out of scope for a permission plugin?
    Wouldn't it make sense to keep permissionEx just for managing the permissions and extract all modifyworld into an external additional plugin? Maybe someone wants to use permissionEx with WorldGuard etc.
    Or did I understand something wrong?
     
  27. Offline

    Abadon84

    we use it together with worldguard, but with the modifyworld nodes you can adjust finer who can do what. and not only turn some things of completly.
     
  28. Offline

    ToastedJelly

    I see, still think seperate plugins for seperate concerns is the better design decision.
    It's also easier for communicating what actually changed - like if a new update would just change the modifyworld part, users that just use the permissions would still see a new version number and think they'd have to update etc.
    Since I got rid of Essentials I see the benefits of one plugin just doing one thing. Much easier to replace any part.
    Or what happens if bukkit permissions arrive and i still want to use the modifyworld stuff?
    Lots of reasons to keep everything modular.
    What do you think, t3h?
     
  29. Offline

    lycano

    Well with modifyworld internal permission system you can finegrade special events to prevent players from building or modifining stuff. Shure this is not a complete replacement for WorldGuard but if you dont want to use WorldGuard you can use these nodes to fine grade your permissions.

    In my opinion pex can hold it ^^ As a complete permissions system should handle Events too. And thats what those nodes represents.
     
  30. Offline

    t3hk0d3

    I think you are right, one thing should do one thing, this is UNIX way, a good way :)
    And you gave me a good idea, now modifyworld are toggleable (permission.modifyworld) and disabled by default.

    Sometimes having a big load of plugins for every cough are bad too, it's convenient to have all-in-one stuff. So it's best way here is to give a choice. Join dark side, we have cookies :)
     
Thread Status:
Not open for further replies.

Share This Page