From 395655ba19a3a2e2b348a19348d2de2efaf12b4b Mon Sep 17 00:00:00 2001 From: ElgarL Date: Wed, 22 May 2013 10:37:24 +0100 Subject: Check subgroup permissions with an equal priority so no one subgroup is higher ranked than another. --- .../permissions/AnjoPermissionsHandler.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'EssentialsGroupManager/src/org/anjocaido') diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index bef2fb713..3a6adee2e 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -849,13 +849,26 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { // SUBGROUPS CHECK for (Group subGroup : user.subGroupListCopy()) { PermissionCheckResult resultSubGroup = checkGroupPermissionWithInheritance(subGroup, targetPermission); + + if (resultSubGroup.resultType != PermissionCheckResult.Type.NOTFOUND) { - resultSubGroup.accessLevel = targetPermission; - return resultSubGroup; + + if ((resultSubGroup.resultType == PermissionCheckResult.Type.FOUND) && (result.resultType != PermissionCheckResult.Type.NEGATION)) { + resultSubGroup.accessLevel = targetPermission; + result = resultSubGroup; + } else if (resultSubGroup.resultType == PermissionCheckResult.Type.EXCEPTION) { + resultSubGroup.accessLevel = targetPermission; + return resultSubGroup; + } else if (resultSubGroup.resultType == PermissionCheckResult.Type.NEGATION) { + resultSubGroup.accessLevel = targetPermission; + result = resultSubGroup; + } + } } // THEN IT RETURNS A NOT FOUND + // OR THE RESULT OF THE SUBGROUP SEARCH. return result; } -- cgit v1.2.3