mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 00:20:44 +00:00
Merge branch 'fix-primary-perms'
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user