Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make permission plugin detection more generic in Superperms handler #1356

Closed
wants to merge 1 commit into from

Conversation

lucko
Copy link
Contributor

@lucko lucko commented Jun 30, 2017

Previously there was just a hard coded list of permission plugins. There's a number of new permission plugins which have emerged recently, which are not in this list. Instead of adding them, I've changed the way they're detected.

Instead of checking for absolute matches, a plugin will be deemed a "permission provider" if its name:

  • contains permissions
  • ends with perms
  • is GroupManager or Privileges (special cases)

This is necessary, as if Vault is not installed and the user is running an "unsupported" permissions plugin (one that's not in the list), Essentials will fallback to using config based permissions.

https://github.com/drtshock/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java#L112-L117
(the config option "useSuperperms" is false by default)

This means that any permissions set by the user are ignored.

However, if a plugin is detected in the list above, Superperms will be selected, and config permissions will be ignored. (the correct behaviour)
https://github.com/drtshock/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java#L100

Related to LuckPerms/LuckPerms#348

if (specialCasePlugins.contains(plugin.getName())) {
final boolean match = plugin.getName().toLowerCase().contains("permissions") ||
plugin.getName().toLowerCase().endsWith("perms") ||
plugin.getName().equals("GroupManager") ||
Copy link

@Zarthus Zarthus Jun 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be easier to maintain if you still keep the set of special cases outside of the loop and use the .contains() call but keep the .endsWith(perms) and .contains(permissions) calls to simplify it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think it was worth it for just two exceptions. It's faster doing it that way too, as opposed to constructing a list each time the method is called. Not a huge deal imho, but I'll change it if that would be preferred. 🙂

@SupaHam
Copy link
Member

SupaHam commented Jun 30, 2017

Hey,

Thanks for your contribution. After looking into this further we've come to the conclusion that defaulting use-bukkit-permissions to true is the best option here.

Although this PR fixes the problem for LuckPerms, it doesn't fix the problem generally. So we'd rather fix this all together for everyone.

What this will do is make Bukkit permission plugins a priority over EssentialsX's built-in permissions. Although I appreciate the efforts of the initial Essentials developers, I have to say this feature is one of the features I've seen rarely used, and I say that as a general fact from my experience over the years rather than hard numbers.

This will NOT fix the issue immediately, this will be fixed as new configuration files are generated, or if we encourage our users to modify their Essentials config to set use-bukkit-permissions: true.

Thank you once more. :) <3

@SupaHam SupaHam closed this Jun 30, 2017
SupaHam added a commit that referenced this pull request Jun 30, 2017
See #1356 for more information.

This change was made with the confident presumption that the use of built-in EssentialsX permissions is very very low compared to those who use feature-complete permission plugins.
@lucko
Copy link
Contributor Author

lucko commented Jun 30, 2017

Although I appreciate the efforts of the initial Essentials developers, I have to say this feature is one of the features I've seen rarely used, and I say that as a general fact from my experience over the years rather than hard numbers.

It probably made sense in the early days, but yeah, not really anymore. I'd never noticed it myself because my testing environment has Vault in it.

This will NOT fix the issue immediately, this will be fixed as new configuration files are generated, or if we encourage our users to modify their Essentials config to set use-bukkit-permissions: true.

Yeah, that's not great either. Server admins expect permissions to work without having to enable them for each plugin.

I agree, hacking around it & trying to detect certain substrings is a bad fix (this PR), but a hardcoded list of plugins is poor design too. 😕

Although this PR fixes the problem for LuckPerms, it doesn't fix the problem generally. So we'd rather fix this all together for everyone.

If all I cared about was fixing it for my own plugin, I would've just added it to to the list... That wasn't my intention at all.

I appreciate it's a tricky issue, changing the default is probably the best fix.
Thanks for your reply. :)

@SupaHam
Copy link
Member

SupaHam commented Jun 30, 2017

I've already made a commit d5cbfef that changes the default. From now on all new configurations will set use-bukkit-permissions to true. As you get more and more issues about this, I'd suggest you create a saved reply on GitHub and just send it off :)

If you could, tell them something along the lines of "EssentialsX has been updated to fix this problem by default. Please update <here>" with a link to https://ci.drtshock.net/job/EssentialsX/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants