LuckPerms

LuckPerms

41.4k Downloads

PermissionAttachments not properly handled / prioritized.

mibby opened this issue ยท 2 comments

commented

LuckPerms dev 362

Spigot API supports PermissionAttachments so plugins can temporarily provide or negate permissions on a user without adding the permission directly to the user permission file.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/permissions/PermissionAttachment.html

I use this functionality in two of my arena plugins to force negate permissions some players may have and to unlock more features for users while they are in an arena - such as mcmmo abilities. This is used to maintain an equal and fair playing field between all players.

Example 1 - PVPArena (negating permissions)
https://github.com/slipcor/pvparena_modules/tree/master/m_TempPerms/src/net/slipcor/pvparena/modules/tempperms
https://github.com/slipcor/pvparena/blob/master/doc/mods/tempperms.md

perms:
  default:
  - -worldedit.navigation.thru.tool
  - -worldedit.navigation.jumpto.tool

Example 2 - MobArena (providing permissions)
https://github.com/garbagemule/MobArena/blob/9bb7bc1f110fb5a2f6965d7a62cf99db94896709/src/main/java/com/garbagemule/MobArena/ArenaClass.java#L207

classes:
  Assassin:
    permissions:
    - mcmmo.ability.swords.serratedstrikes
  Berserker:
    permissions:
    - mcmmo.ability.unarmed.berserk

Since moving to LuckPerms from PermissionsEx, I'm getting reports that players are able to use the compass TP ability (worldedit tool permission) while playing inside that arena. This leads me to believe that PermissionAttachment is not properly supported in LuckPerms or it isn't overriding all other permissions as the topmost priority. PEX properly handles temporary adding and removing permissions as the intended priority.

Would it be possible to fix this implementation or change the behavior so intended temporary addition / removal permissions are forced over group / user permission inheritence?

commented

Let me know how it goes :)

commented

Haven't tested extensively but getting reports that temporary permissions are working as intended now. Added when inside the arena (+ takes priority), removed when leaving the arena.

Thanks. :)