Ensure child permissions are handled as lowercase when resolving (#2761)

This commit is contained in:
Luck 2020-12-14 15:22:41 +00:00
parent e6a5cb06af
commit 16fbf566f3
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 10 additions and 6 deletions

View File

@ -180,16 +180,18 @@ public final class LuckPermsPermissionMap extends ForwardingMap<String, Permissi
continue;
}
if (accumulator.containsKey(e.getKey())) {
String key = e.getKey().toLowerCase();
if (accumulator.containsKey(key)) {
continue; // Prevent infinite loops
}
// xor the value using the parent (bukkit logic, not mine)
boolean value = e.getValue() ^ invert;
accumulator.put(e.getKey().toLowerCase(), value);
accumulator.put(key, value);
// lookup any deeper children & resolve if present
Permission perm = this.delegate.get(e.getKey());
Permission perm = this.delegate.get(key);
if (perm != null) {
resolveChildren(accumulator, perm.getChildren(), !value);
}

View File

@ -180,16 +180,18 @@ public final class LuckPermsPermissionMap extends ForwardingMap<String, Permissi
continue;
}
if (accumulator.containsKey(e.getKey())) {
String key = e.getKey().toLowerCase();
if (accumulator.containsKey(key)) {
continue; // Prevent infinite loops
}
// xor the value using the parent (nukkit logic, not mine)
boolean value = e.getValue() ^ invert;
accumulator.put(e.getKey().toLowerCase(), value);
accumulator.put(key, value);
// lookup any deeper children & resolve if present
Permission perm = this.delegate.get(e.getKey());
Permission perm = this.delegate.get(key);
if (perm != null) {
resolveChildren(accumulator, perm.getChildren(), !value);
}