Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 03:50:06 +01:00
Added hierarchical permissions support to permission resolvers, improved Permissions support.
Dieser Commit ist enthalten in:
Ursprung
02de4c8200
Commit
f683959420
@ -94,6 +94,13 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
|
||||
}
|
||||
|
||||
public boolean hasPermission(String player, String permission) {
|
||||
int dotPos = permission.lastIndexOf(".");
|
||||
if (dotPos > -1) {
|
||||
if (hasPermission(player, permission.substring(0, dotPos))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> perms = userPermissionsCache.get(player.toLowerCase());
|
||||
if (perms == null) {
|
||||
return defaultPermissionsCache.contains(permission)
|
||||
|
@ -153,6 +153,13 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
|
||||
}
|
||||
|
||||
public boolean hasPermission(String player, String permission) {
|
||||
int dotPos = permission.lastIndexOf(".");
|
||||
if (dotPos > -1) {
|
||||
if (hasPermission(player, permission.substring(0, dotPos))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> perms = userPermissionsCache.get(player.toLowerCase());
|
||||
if (perms == null) {
|
||||
return defaultPermissionsCache.contains(permission)
|
||||
|
@ -55,6 +55,12 @@ public class GroupUsersPemissionsResolver implements PermissionsResolver {
|
||||
try {
|
||||
Player player = server.getPlayer(name);
|
||||
if (player == null) return false;
|
||||
int dotPos = permission.lastIndexOf(".");
|
||||
if (dotPos > -1) {
|
||||
if (hasPermission(name, permission.substring(0, dotPos))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return groupUsers.playerCanUseCommand(player, permission);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
|
@ -67,7 +67,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
|
||||
try {
|
||||
Player player = server.getPlayer(name);
|
||||
if (player == null) return false;
|
||||
return group.equals(api.Security.getGroup(player.getName()));
|
||||
return api.Security.inGroup(name, group);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
return false;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren