Add config options to allow for finer control over how permissions are calculated, and set include-global to true on BungeeCord by default
This commit is contained in:
@@ -52,22 +52,33 @@ public class BukkitCalculatorFactory extends AbstractCalculatorFactory {
|
||||
|
||||
@Override
|
||||
public PermissionCalculator build(Contexts contexts, User user) {
|
||||
UUID uuid = plugin.getUuidCache().getExternalUUID(user.getUuid());
|
||||
|
||||
ImmutableList.Builder<PermissionProcessor> processors = ImmutableList.builder();
|
||||
|
||||
processors.add(new MapProcessor());
|
||||
processors.add(new ChildProcessor(plugin.getChildPermissionProvider()));
|
||||
processors.add(new AttachmentProcessor(() -> {
|
||||
LPPermissible permissible = Injector.getPermissible(uuid);
|
||||
return permissible == null ? null : permissible.getAttachmentPermissions();
|
||||
}));
|
||||
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_CHILD_PERMISSIONS)) {
|
||||
processors.add(new ChildProcessor(plugin.getChildPermissionProvider()));
|
||||
}
|
||||
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_ATTACHMENT_PERMISSIONS)) {
|
||||
final UUID uuid = plugin.getUuidCache().getExternalUUID(user.getUuid());
|
||||
processors.add(new AttachmentProcessor(() -> {
|
||||
LPPermissible permissible = Injector.getPermissible(uuid);
|
||||
return permissible == null ? null : permissible.getAttachmentPermissions();
|
||||
}));
|
||||
}
|
||||
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLYING_REGEX)) {
|
||||
processors.add(new RegexProcessor());
|
||||
}
|
||||
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLYING_WILDCARDS)) {
|
||||
processors.add(new WildcardProcessor());
|
||||
}
|
||||
processors.add(new DefaultsProcessor(contexts.isOp(), plugin.getDefaultsProvider()));
|
||||
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS)) {
|
||||
processors.add(new DefaultsProcessor(contexts.isOp(), plugin.getDefaultsProvider()));
|
||||
}
|
||||
|
||||
return registerCalculator(new PermissionCalculator(plugin, user.getFriendlyName(), processors.build()));
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ package me.lucko.luckperms.bukkit.calculators;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.bukkit.model.ChildPermissionProvider;
|
||||
import me.lucko.luckperms.common.calculators.PermissionProcessor;
|
||||
@@ -49,7 +51,7 @@ public class ChildProcessor implements PermissionProcessor {
|
||||
public void updateBacking(Map<String, Boolean> map) {
|
||||
childPermissions.clear();
|
||||
for (Map.Entry<String, Boolean> e : map.entrySet()) {
|
||||
Map<String, Boolean> children = provider.getPermissions().get(e);
|
||||
Map<String, Boolean> children = provider.getPermissions().get(Maps.immutableEntry(e.getKey(), e.getValue()));
|
||||
if (children != null) {
|
||||
childPermissions.putAll(children);
|
||||
}
|
||||
|
||||
@@ -95,6 +95,24 @@ apply-regex: true
|
||||
# If set to true, LuckPerms will detect and expand shorthand node patterns.
|
||||
apply-shorthand: true
|
||||
|
||||
# If the plugin should apply Bukkit child permissions.
|
||||
# Plugin authors can define custom permissions structures for their plugin, which will be resolved and used
|
||||
# by LuckPerms if this setting is enabled.
|
||||
apply-bukkit-child-permissions: true
|
||||
|
||||
# If the plugin should apply Bukkit default permissions.
|
||||
# Plugin authors can define permissions which should be given to all users by default, or setup permissions
|
||||
# which should/shouldn't be given to opped players.
|
||||
# If this option is set to false, LuckPerms will ignore these defaults.
|
||||
apply-bukkit-default-permissions: true
|
||||
|
||||
# If the plugin should apply attachment permissions.
|
||||
# Other plugins on the server are able to add their own "permission attachments" to players. This allows
|
||||
# them to grant players additional permissions which last until the end of the session, or until they're removed.
|
||||
# If this option is set to false, LuckPerms will not include these attachment permissions when considering if a
|
||||
# player should have access to a certain permission.
|
||||
apply-bukkit-attachment-permissions: true
|
||||
|
||||
# Define special group weights for this server.
|
||||
# Default is just 0.
|
||||
group-weight:
|
||||
|
||||
Reference in New Issue
Block a user