Add method to check if configured value is a group reference
Change-Id: Ieff950a4867b5e97bee2aa663e9db6023f73655e
This commit is contained in:
@@ -30,6 +30,10 @@ public class GroupReference implements Comparable<GroupReference> {
|
||||
return new GroupReference(group.getGroupUUID(), group.getName());
|
||||
}
|
||||
|
||||
public static boolean isGroupReference(String configValue) {
|
||||
return configValue != null && configValue.startsWith(PREFIX);
|
||||
}
|
||||
|
||||
public static GroupReference fromString(String ref) {
|
||||
String name = ref.substring(ref.indexOf("[") + 1, ref.lastIndexOf("/")).trim();
|
||||
String uuid = ref.substring(ref.lastIndexOf("/") + 1, ref.lastIndexOf("]")).trim();
|
||||
|
||||
@@ -238,7 +238,7 @@ public class PermissionRule implements Comparable<PermissionRule> {
|
||||
src = src.substring("+force ".length()).trim();
|
||||
}
|
||||
|
||||
if (mightUseRange && !src.startsWith(GroupReference.PREFIX)) {
|
||||
if (mightUseRange && !GroupReference.isGroupReference(src)) {
|
||||
int sp = src.indexOf(' ');
|
||||
String range = src.substring(0, sp);
|
||||
|
||||
@@ -254,7 +254,7 @@ public class PermissionRule implements Comparable<PermissionRule> {
|
||||
src = src.substring(sp + 1).trim();
|
||||
}
|
||||
|
||||
if (src.startsWith(GroupReference.PREFIX)) {
|
||||
if (GroupReference.isGroupReference(src)) {
|
||||
src = src.substring(6).trim();
|
||||
GroupReference group = new GroupReference();
|
||||
group.setName(src);
|
||||
|
||||
Reference in New Issue
Block a user