1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-13 18:14:38 +02:00

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

This commit is contained in:
ElgarL
2013-10-31 11:40:12 +00:00
parent ea824b26f4
commit a66b9a3ee4
2 changed files with 9 additions and 0 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() + "'.");