What happens on permission collision?

if player has some permission true
but group that contains this player has the same permission false
which value will be returned in entity.haspermission???
and in this plugin???

Permissions are based on inheritance. So for example, a player with rank “moderator” might have the following inheritance:

ZephireNZ -> Moderator -> Player -> Global

If a permissions is not mentioned (ie as true/false) at the player level, then the Permission manager generally will look at its parent. In this case, it’ll check Moderator for that permission. Repeat until there’s nothing more to check.

So if you’ve got my.permission as true at the player level, but false at the Moderator level, then the permission will resolve as true because that’s what it found first.

3 Likes

I think it’s implementation dependent though right?

It’s normally the case, but I’m pretty sure that the plugin implementing the permissions gets the last say, and that SpongeAPI doesn’t actually enforce this?

What is encoded into the specification however, and shouldn’t be violated, is that permission nodes themselves “exampleplugin.command” is hierarchical. so granting a player “exampleplugin” should give “exampleplugin.command” as well as “exampleplugin.command2”