summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src
diff options
context:
space:
mode:
authorElgarL <ElgarL@Palmergames.com>2014-03-27 12:55:01 +0000
committerKHobbits <rob@khobbits.co.uk>2014-05-04 12:50:16 +0100
commit226f921819a9bc395595f2089d70f13d4bdeee2d (patch)
tree51d555e0c3b8c540d17c20feefd725f315575e93 /EssentialsGroupManager/src
parent931de7bd66e7be28931d97ca608c221882037091 (diff)
downloadEssentials-226f921819a9bc395595f2089d70f13d4bdeee2d.tar
Essentials-226f921819a9bc395595f2089d70f13d4bdeee2d.tar.gz
Essentials-226f921819a9bc395595f2089d70f13d4bdeee2d.tar.lz
Essentials-226f921819a9bc395595f2089d70f13d4bdeee2d.tar.xz
Essentials-226f921819a9bc395595f2089d70f13d4bdeee2d.zip
Do not override higher level permissions with negations.
Diffstat (limited to 'EssentialsGroupManager/src')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java14
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;
}