summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org/anjocaido/groupmanager
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-10-31 20:07:21 +0000
committerElgarL <ElgarL@palmergames.com>2011-10-31 20:07:21 +0000
commit16062606808a2f39b6e8fac39eadc1e4c1984087 (patch)
tree2530fd3c72e79bb71194141224c3e5b99e42b9f8 /EssentialsGroupManager/src/org/anjocaido/groupmanager
parent2e24240c498eb178ca009d11db3b60ec7fb34a44 (diff)
downloadEssentials-16062606808a2f39b6e8fac39eadc1e4c1984087.tar
Essentials-16062606808a2f39b6e8fac39eadc1e4c1984087.tar.gz
Essentials-16062606808a2f39b6e8fac39eadc1e4c1984087.tar.lz
Essentials-16062606808a2f39b6e8fac39eadc1e4c1984087.tar.xz
Essentials-16062606808a2f39b6e8fac39eadc1e4c1984087.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')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java8
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java48
2 files changed, 47 insertions, 9 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 8a6960697..ebb63653a 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -1176,11 +1176,17 @@ public class GroupManager extends JavaPlugin {
}
// VALIDANDO PERMISSAO
auxGroup = auxUser.getGroup();
- auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1], null);
+ auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]);
if (!auxUser.getVariables().hasVar(args[1])) {
+ // Check sub groups
+ if (!auxUser.isSubGroupsEmpty() && auxGroup2 == null)
+ for (Group subGroup : auxUser.subGroupListCopy()) {
+ auxGroup2 = permissionHandler.nextGroupWithVariable(subGroup, args[1]);
+ }
if (auxGroup2 == null) {
sender.sendMessage(ChatColor.RED + "The user doesn't have access to that variable!");
+ return false;
}
}
// PARECE OK
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);