mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Added hierarchical permissions support to permission resolvers, improved Permissions support.
This commit is contained in:
parent
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;
|
||||
|
Loading…
Reference in New Issue
Block a user