diff options
author | ElgarL <ElgarL@Palmergames.com> | 2014-03-27 12:55:01 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2014-05-04 12:50:16 +0100 |
commit | 0ef79eea00fcf82dab04bf911b446356a7f3dccd (patch) | |
tree | dc2bc86d9ac702f0760e2406493fec9e62e310f9 /EssentialsGroupManager/src/org/anjocaido | |
parent | 55abcd6636771a0db8c6240b963e84111253b07f (diff) | |
download | Essentials-0ef79eea00fcf82dab04bf911b446356a7f3dccd.tar Essentials-0ef79eea00fcf82dab04bf911b446356a7f3dccd.tar.gz Essentials-0ef79eea00fcf82dab04bf911b446356a7f3dccd.tar.lz Essentials-0ef79eea00fcf82dab04bf911b446356a7f3dccd.tar.xz Essentials-0ef79eea00fcf82dab04bf911b446356a7f3dccd.zip |
Do not override higher level permissions with negations.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 6eda3f1cc..07a846791 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -919,9 +919,15 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { return resultGroup; } - result = resultGroup; + // Do not override higher level permissions with negations. + if (result.resultType == PermissionCheckResult.Type.NOTFOUND) { + result = resultGroup; + } } + + // Do we have a high level negation? + boolean negated = (result.resultType == PermissionCheckResult.Type.NEGATION); // SUBGROUPS CHECK for (Group subGroup : user.subGroupListCopy()) { @@ -931,15 +937,17 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { resultSubGroup.accessLevel = targetPermission; + // Allow exceptions to override higher level negations + // but low level negations can not remove higher level permissions. if (resultSubGroup.resultType == PermissionCheckResult.Type.EXCEPTION) { return resultSubGroup; - } else if ((resultSubGroup.resultType == PermissionCheckResult.Type.FOUND) && (result.resultType != PermissionCheckResult.Type.NEGATION)) { + } else if ((resultSubGroup.resultType == PermissionCheckResult.Type.FOUND) && (result.resultType != PermissionCheckResult.Type.NEGATION) && !negated) { result = resultSubGroup; - } else if (resultSubGroup.resultType == PermissionCheckResult.Type.NEGATION) { + } else if ((resultSubGroup.resultType == PermissionCheckResult.Type.NEGATION) && !negated) { result = resultSubGroup; } |