diff options
author | ElgarL <ElgarL@palmergames.com> | 2011-10-31 20:07:21 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2011-10-31 20:07:21 +0000 |
commit | 9734274ed1b61ba50272324a2bd72723e6b576be (patch) | |
tree | 07660146368dd8aefe1d3cff9571efe8da84f59e /EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions | |
parent | 3f2916967d88fddc1c69f62ffd7ca572d25d9992 (diff) | |
download | Essentials-9734274ed1b61ba50272324a2bd72723e6b576be.tar Essentials-9734274ed1b61ba50272324a2bd72723e6b576be.tar.gz Essentials-9734274ed1b61ba50272324a2bd72723e6b576be.tar.lz Essentials-9734274ed1b61ba50272324a2bd72723e6b576be.tar.xz Essentials-9734274ed1b61ba50272324a2bd72723e6b576be.zip |
Fixed an error on 'manucheckv'. If the users doesn't have the variable
it fell through causing an exception.
Added checking of subgroups for Info nodes.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 98c062ea5..e7939c411 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -438,7 +438,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { /** * Returns the variable value of the user, in INFO node. If not found, it - * will search for his Group variables. It will harvest the inheritance. + * will search for his Group variables. It will harvest the inheritance + * and subgroups. * * @param user * @param variable @@ -459,7 +460,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } Group result = nextGroupWithVariable(start, variable); if (result == null) { - return ""; + // Check sub groups + if (!auser.isSubGroupsEmpty()) + for (Group subGroup : auser.subGroupListCopy()) { + result = nextGroupWithVariable(subGroup, variable); + // Found value? + if (result != null) continue; + } + if (result == null) return ""; } return result.getVariables().getVarString(variable); // return getUserPermissionString(user, variable); @@ -467,7 +475,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { /** * Returns the variable value of the user, in INFO node. If not found, it - * will search for his Group variables. It will harvest the inheritance. + * will search for his Group variables. It will harvest the inheritance + * and subgroups. * * @param user * @param variable @@ -488,7 +497,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } Group result = nextGroupWithVariable(start, variable); if (result == null) { - return -1; + // Check sub groups + if (!auser.isSubGroupsEmpty()) + for (Group subGroup : auser.subGroupListCopy()) { + result = nextGroupWithVariable(subGroup, variable); + // Found value? + if (result != null) continue; + } + if (result == null) return -1; } return result.getVariables().getVarInteger(variable); // return getUserPermissionInteger(string, string1); @@ -496,7 +512,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { /** * Returns the variable value of the user, in INFO node. If not found, it - * will search for his Group variables. It will harvest the inheritance. + * will search for his Group variables. It will harvest the inheritance + * and subgroups. * * @param user * @param variable @@ -517,7 +534,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } Group result = nextGroupWithVariable(start, variable); if (result == null) { - return false; + // Check sub groups + if (!auser.isSubGroupsEmpty()) + for (Group subGroup : auser.subGroupListCopy()) { + result = nextGroupWithVariable(subGroup, variable); + // Found value? + if (result != null) continue; + } + if (result == null) return false; } return result.getVariables().getVarBoolean(variable); // return getUserPermissionBoolean(user, string1); @@ -525,7 +549,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { /** * Returns the variable value of the user, in INFO node. If not found, it - * will search for his Group variables. It will harvest the inheritance. + * will search for his Group variables. It will harvest the inheritance + * and subgroups. * * @param user * @param variable @@ -546,7 +571,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } Group result = nextGroupWithVariable(start, variable); if (result == null) { - return -1.0D; + // Check sub groups + if (!auser.isSubGroupsEmpty()) + for (Group subGroup : auser.subGroupListCopy()) { + result = nextGroupWithVariable(subGroup, variable); + // Found value? + if (result != null) continue; + } + if (result == null) return -1.0D; } return result.getVariables().getVarDouble(variable); // return getUserPermissionDouble(string, string1); |