summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src
diff options
context:
space:
mode:
authorElgarL <ElgarL@Palmergames.com>2013-07-28 09:10:23 +0100
committerKHobbits <rob@khobbits.co.uk>2014-05-04 12:50:09 +0100
commit5129ad7d256e8c8bb3d4620479802ffee794eb61 (patch)
tree25c58fdae2f70a172663bc4d7f0e1f80ef0a5b87 /EssentialsGroupManager/src
parent80f5972c04708d06fc3c31804655511ff1ddb926 (diff)
downloadEssentials-5129ad7d256e8c8bb3d4620479802ffee794eb61.tar
Essentials-5129ad7d256e8c8bb3d4620479802ffee794eb61.tar.gz
Essentials-5129ad7d256e8c8bb3d4620479802ffee794eb61.tar.lz
Essentials-5129ad7d256e8c8bb3d4620479802ffee794eb61.tar.xz
Essentials-5129ad7d256e8c8bb3d4620479802ffee794eb61.zip
Prevent adding sub groups for ranks the granting player doesn't have access to.
Diffstat (limited to 'EssentialsGroupManager/src')
-rw-r--r--EssentialsGroupManager/src/Changelog.txt1
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java10
2 files changed, 10 insertions, 1 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index fcdd930f0..d30265810 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -222,3 +222,4 @@ v 2.0:
- Store worldSelection indexed on the senders name rather than the object (fixes commandblocks using manselect).
- Check subgroup permissions with an equal priority so no one subgroup is higher ranked than another.
- add recursive permission adding/deleting
+ - Prevent adding sub groups for ranks the granting player doesn't have access to. \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index dcbfbd326..24a70d465 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -611,6 +611,14 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return true;
}
+ if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
+ sender.sendMessage(ChatColor.RED + "The sub-group can't be the same as yours, or higher.");
+ return true;
+ }
+ if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
+ sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
+ return true;
+ }
// Seems OK
if (auxUser.addSubGroup(auxGroup))
sender.sendMessage(ChatColor.YELLOW + "You added subgroup '" + auxGroup.getName() + "' to player '" + auxUser.getName() + "'.");
@@ -993,7 +1001,7 @@ public class GroupManager extends JavaPlugin {
}
// Validating arguments
if (args.length < 2) {
- sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangaaddp <group> <permission> [permission2] [permission3]...)");
+ sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangaddp <group> <permission> [permission2] [permission3]...)");
return true;
}