Add config option to prevent primary group removal (#405)
This commit is contained in:
parent
925d3ccd1b
commit
754c7d8e3b
@ -105,6 +105,10 @@ temporary-add-behaviour: deny
|
||||
# directly and indirectly
|
||||
primary-group-calculation: stored
|
||||
|
||||
# If set to false, the plugin will allow a Users primary group to be removed with the
|
||||
# 'parent remove' command, and will set their primary group back to default.
|
||||
prevent-primary-group-removal: false
|
||||
|
||||
# If the plugin should check for "extra" permissions with users run LP commands.
|
||||
#
|
||||
# These extra permissions allow finer control over what users can do with each command, and
|
||||
|
@ -108,6 +108,10 @@ temporary-add-behaviour: deny
|
||||
# directly and indirectly
|
||||
primary-group-calculation: stored
|
||||
|
||||
# If set to false, the plugin will allow a Users primary group to be removed with the
|
||||
# 'parent remove' command, and will set their primary group back to default.
|
||||
prevent-primary-group-removal: false
|
||||
|
||||
# If the plugin should check for "extra" permissions with users run LP commands.
|
||||
#
|
||||
# These extra permissions allow finer control over what users can do with each command, and
|
||||
|
@ -79,7 +79,8 @@ public class ParentRemove extends SharedSubCommand {
|
||||
if (holder instanceof User) {
|
||||
User user = (User) holder;
|
||||
|
||||
boolean shouldPrevent = (context.isEmpty() || context.has("server", "global")) &&
|
||||
boolean shouldPrevent = plugin.getConfiguration().get(ConfigKeys.PREVENT_PRIMARY_GROUP_REMOVAL) &&
|
||||
context.isEmpty() &&
|
||||
plugin.getConfiguration().get(ConfigKeys.PRIMARY_GROUP_CALCULATION_METHOD).equals("stored") &&
|
||||
user.getPrimaryGroup().getStoredValue().equalsIgnoreCase(groupName);
|
||||
|
||||
|
@ -166,6 +166,12 @@ public class ConfigKeys {
|
||||
}
|
||||
}));
|
||||
|
||||
/**
|
||||
* If set to false, the plugin will allow a Users primary group to be removed with the
|
||||
* 'parent remove' command, and will set their primary group back to default.
|
||||
*/
|
||||
public static final ConfigKey<Boolean> PREVENT_PRIMARY_GROUP_REMOVAL = BooleanKey.of("prevent-primary-group-removal", true);
|
||||
|
||||
/**
|
||||
* If the plugin should check for "extra" permissions with users run LP commands
|
||||
*/
|
||||
|
@ -106,6 +106,10 @@ temporary-add-behaviour="deny"
|
||||
# directly and indirectly
|
||||
primary-group-calculation="parents-by-weight"
|
||||
|
||||
# If set to false, the plugin will allow a Users primary group to be removed with the
|
||||
# 'parent remove' command, and will set their primary group back to default.
|
||||
prevent-primary-group-removal=false
|
||||
|
||||
# If the plugin should check for "extra" permissions with users run LP commands.
|
||||
#
|
||||
# These extra permissions allow finer control over what users can do with each command, and
|
||||
|
Loading…
Reference in New Issue
Block a user