Merge branch 'fix-primary-perms'

This commit is contained in:
okx-code
2026-01-08 00:45:00 +00:00
2 changed files with 15 additions and 0 deletions

View File

@@ -458,6 +458,15 @@ public class GroupManager {
*/
private boolean hasPlayerInheritsPerms(Group group, UUID player, PermissionType perm) {
while (group != null) {
// TODO: Revisit this. Being the primary owner of a group should arguably work like OP where you, in-effect,
// have all grantable permissions. However, this would break certain civ-mechanics that use NameLayer
// permissions as feature-toggles, notably JukeAlert with snitch immunity where having the permission
// by definition means you *are* immune to snitches. Contrast this with SuperVanish where having the
// permission means you *can* vanish. Thus the .isOwnerPermission() check has been added to only give
// the OP-like behaviour to existential group permissions like "DELETE", "MERGE", and "PERMS".
if (group.isOwner(player) && perm.isOwnerPermission()) {
return true;
}
PlayerType type = group.getPlayerType(player);
if (type != null && getPermissionforGroup(group).hasPermission(type, perm)) {
return true;

View File

@@ -165,4 +165,10 @@ public class PermissionType {
public boolean getCanBeBlacklisted() {
return canBeBlacklisted;
}
/// Tests whether this permission is an "owner" permission, meaning that, ***by default***, only [PlayerType#OWNER]
/// can use it.
public boolean isOwnerPermission() {
return List.of(PlayerType.OWNER).equals(this.defaultPermLevels);
}
}