LuckPerms

LuckPerms

41.4k Downloads

Circular inheritance causing permission bug.

mibby opened this issue ยท 2 comments

commented

Description

I'm running into an issue with staff members who inherit a permission from multiple groups, they aren't able to inherit a positive permission from the higher weighted group.

I believe this is caused by a circular inheritance bug.

Essentials grants the permissions essentials.back.into.<world> for loaded worlds to all players by default, set by the plugin.
EssentialsX/Essentials@b29f98c#diff-d515c857ac85b710ac67491e3dd1779aR879-R883

However I negate the permission for the adventure world for people who have the back permission. (Which is fine, removing permissions works and takes priority.)

The issue comes when I try to add it back. Permissions I'm assuming is doing a logic check of Player was given x.y.z by plugin as value true -> Group was setup to revoke permission x.y.z by default -> Player inherits secondary group to give permission x.y.z as value true with a higher weight but it's assumed the player was already given this value by the plugin.

True -> False -> True (Break)

Reproduction steps

In Essential's config, enable the following settings;

# Set to true to enable per-world permissions for teleporting between worlds with essentials commands.
# This applies to /world, /back, /tp[a|o][here|all], but not warps.
# Give someone permission to teleport to a world with essentials.worlds.<worldname>
# This does not affect the /home command, there is a separate toggle below for this.
world-teleport-permissions: true

#Do you want Essentials to keep track of previous location for /back in the teleport listener?
#If you set this to true any plugin that uses teleport will have the previous location registered.
register-back-in-listener: true
  1. Give yourself the following parent groups;
  2. /lp group <user> parent add Member
  3. /lp group <user> parent add Moderator
  4. /lp group <user> parent add Executive
  5. Set your primary group to moderator if it isn't already due to weighting.
  6. Go to the world adventure, then go to another world such as world, then try to /back to go back into the adventure world.
  7. Unable to teleport despite having a group given the permission from a higher weighted group.

Group Executive.yml

name: executive
permissions:
- essentials.back:
    value: false
    world: adventure
- essentials.back.ondeath:
    value: false
    world: adventure
- displayname.Executive
- essentials.back
- essentials.back.into.adventure:
    value: false
- essentials.back.ondeath
- weight.5
parents:
- supporter
prefixes:
- '&#458609':
    priority: 5
meta:
- weight:
    value: '15'

Group Moderator.yml

name: moderator
permissions:
- essentials.tppos:
    value: false
    context:
      world: adventure
      gamemode: survival
- displayname.Mod
- essentials.tppos
- weight.16
parents:
- junior-mod
prefixes:
- '&#FF69B4':
    priority: 16
meta:
- weight:
    value: '3'

Group Junior-Mod.yml

name: junior-mod
permissions:
- essentials.back.into.adventure
- essentials.back
- displayname.J-Mod
- weight.15
parents:
- member
prefixes:
- '&#FF69B4':
    priority: 15
meta:
- weight:
    value: '4'

Group Member.yml

name: member
permissions:
- essentials.build.craft.*:
    value: true
    context:
      world: adventure
- essentials.build.drop.*:
    value: true
    context:
      world: adventure
- essentials.build.interact.*:
    value: true
    context:
      world: adventure
- essentials.build.pickup.*:
    value: true
    context:
      world: adventure
- essentials.build:
    value: false
    context:
      world: adventure
- essentials.sethome:
    value: false
    context:
      world: adventure
- essentials.sethome.bed:
    value: false
    context:
      world: adventure
- essentials.tpaccept:
    value: false
    context:
      world: adventure
- essentials.tpahere:
    value: false
    context:
      world: adventure
- displayname.Member
- essentials.worlds.adventure
- essentials.worlds.creative
- essentials.worlds.spawn
- essentials.worlds.wonders
- essentials.worlds.world
- essentials.worlds.world_nether
- essentials.worlds.world_the_end
- weight.5
prefixes:
- '&#8FF7F7':
    priority: 5
meta:
- weight:
    value: '15'

Expected behaviour

Being able to use /back functionality to teleport into the specified world as staff.

Environment details

  • Server type/version: Paper dev 206 (Spigot 1.16.3)
  • LuckPerms version: v5.1.107 (dev 1164)

LuckPerms Config
https://paste.gg/p/anonymous/56ae715366a44d82b903a7336a5bbd07/files/f2f630851bc347769602dfa2a011361e/raw

commented

Try setting the post traversal inheritance sort option to true in the LP config.

commented

Traversal change does seem to fix the issue, thanks.