Prevent adding sub groups for ranks the granting player doesn't have access to.

This commit is contained in:
ElgarL 2013-07-28 09:10:23 +01:00 committed by KHobbits
parent 427dd714c9
commit 3f35a6b59c
2 changed files with 10 additions and 1 deletions

View file

@ -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.

View file

@ -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;
}