mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-11-19 01:40:00 +00:00
Prevent adding sub groups for ranks the granting player doesn't have access to.
This commit is contained in:
parent
427dd714c9
commit
3f35a6b59c
2 changed files with 10 additions and 1 deletions
|
@ -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.
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue