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 | a0e93af758b8f31e30b86b4062734e82492f8491 (patch) | |
tree | 4a5f76fe68683a8556039a5d5dcb299a19bbaacf /EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions | |
parent | 81c6291338b83c5a47f81b7a62a4fea4263775fd (diff) | |
download | Essentials-a0e93af758b8f31e30b86b4062734e82492f8491.tar Essentials-a0e93af758b8f31e30b86b4062734e82492f8491.tar.gz Essentials-a0e93af758b8f31e30b86b4062734e82492f8491.tar.lz Essentials-a0e93af758b8f31e30b86b4062734e82492f8491.tar.xz Essentials-a0e93af758b8f31e30b86b4062734e82492f8491.zip |
Do not override higher level permissions with negations.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions')
-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; } |