diff options
author | ElgarL <ElgarL@Palmergames.com> | 2014-03-27 03:48:20 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2014-05-04 12:50:13 +0100 |
commit | 009f4fede99d44febc65c3280d8315345ee89cc8 (patch) | |
tree | a4b4d1ea04fa424b8c9809dfbdbf7f0df07d6a86 /EssentialsGroupManager/src | |
parent | 64acdbf99e0c31ea8619f57f9dccd8942041efe3 (diff) | |
download | Essentials-009f4fede99d44febc65c3280d8315345ee89cc8.tar Essentials-009f4fede99d44febc65c3280d8315345ee89cc8.tar.gz Essentials-009f4fede99d44febc65c3280d8315345ee89cc8.tar.lz Essentials-009f4fede99d44febc65c3280d8315345ee89cc8.tar.xz Essentials-009f4fede99d44febc65c3280d8315345ee89cc8.zip |
Fix manucheckp to understand and report correctly on Exception nodes.
Diffstat (limited to 'EssentialsGroupManager/src')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java | 4 | ||||
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java | 39 |
2 files changed, 32 insertions, 11 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index 24a70d465..ee5d04490 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -972,6 +972,8 @@ public class GroupManager extends JavaPlugin { if (permissionResult.owner instanceof User) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.YELLOW + "The user has directly a negation node for that permission."); + } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { + sender.sendMessage(ChatColor.YELLOW + "The user has directly an Exception node for that permission."); } else { sender.sendMessage(ChatColor.YELLOW + "The user has directly this permission."); } @@ -979,6 +981,8 @@ public class GroupManager extends JavaPlugin { } else if (permissionResult.owner instanceof Group) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.YELLOW + "The user inherits a negation permission from group: " + permissionResult.owner.getName()); + } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { + sender.sendMessage(ChatColor.YELLOW + "The user inherits an Exception permission from group: " + permissionResult.owner.getName()); } else { sender.sendMessage(ChatColor.YELLOW + "The user inherits the permission from group: " + permissionResult.owner.getName()); } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 8f8f4c599..6eda3f1cc 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -898,32 +898,49 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { PermissionCheckResult resultUser = checkUserOnlyPermission(user, targetPermission); if (resultUser.resultType != PermissionCheckResult.Type.NOTFOUND) { + resultUser.accessLevel = targetPermission; - return resultUser; + + if (resultUser.resultType == PermissionCheckResult.Type.EXCEPTION) { + return resultUser; + } + + result = resultUser; + } - // IT ONLY CHECKS GROUPS PERMISSIONS IF RESULT FOR USER IS NOT FOUND + // IT ONLY CHECKS GROUPS PERMISSIONS IF RESULT FOR USER IS NOT AN EXCEPTION PermissionCheckResult resultGroup = checkGroupPermissionWithInheritance(user.getGroup(), targetPermission); if (resultGroup.resultType != PermissionCheckResult.Type.NOTFOUND) { + resultGroup.accessLevel = targetPermission; - return resultGroup; + + if (resultGroup.resultType == PermissionCheckResult.Type.EXCEPTION) { + return resultGroup; + } + + result = resultGroup; + } // SUBGROUPS CHECK for (Group subGroup : user.subGroupListCopy()) { - PermissionCheckResult resultSubGroup = checkGroupPermissionWithInheritance(subGroup, targetPermission); - + PermissionCheckResult resultSubGroup = checkGroupPermissionWithInheritance(subGroup, targetPermission); if (resultSubGroup.resultType != PermissionCheckResult.Type.NOTFOUND) { - 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; + resultSubGroup.accessLevel = targetPermission; + + if (resultSubGroup.resultType == PermissionCheckResult.Type.EXCEPTION) { + return resultSubGroup; + + } else if ((resultSubGroup.resultType == PermissionCheckResult.Type.FOUND) && (result.resultType != PermissionCheckResult.Type.NEGATION)) { + + result = resultSubGroup; + } else if (resultSubGroup.resultType == PermissionCheckResult.Type.NEGATION) { - resultSubGroup.accessLevel = targetPermission; + result = resultSubGroup; } |