Skip to content

Commit

Permalink
Adding notes
Browse files Browse the repository at this point in the history
  • Loading branch information
RedstoneFuture committed Oct 26, 2023
1 parent cc4ac11 commit 6de005b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public int hasPermissionRange(
}
final String[] nodes = stub.split("\\.");
final StringBuilder n = new StringBuilder();
// Wildcard check from less specific permission to more specific permission
for (int i = 0; i < (nodes.length - 1); i++) {
n.append(nodes[i]).append(".");
if (!stub.equals(n + Permission.PERMISSION_STAR.toString())) {
Expand All @@ -166,9 +167,11 @@ public int hasPermissionRange(
}
}
}
// Wildcard check for the full permission
if (hasPermission(stub + ".*")) {
return Integer.MAX_VALUE;
}
// Permission value cache for iterative check
int max = 0;
if (CHECK_EFFECTIVE) {
boolean hasAny = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ private static boolean checkPermValue(
if (flag instanceof IntegerFlag && MathMan.isInteger(value)) {
try {
int numeric = Integer.parseInt(value);
// Getting full permission without ".<amount>" at the end
perm = perm.substring(0, perm.length() - value.length() - 1);
boolean result = false;
if (numeric >= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ default int hasPermissionRange(
}
String[] nodes = stub.split("\\.");
StringBuilder builder = new StringBuilder();
// Wildcard check from less specific permission to more specific permission
for (int i = 0; i < (nodes.length - 1); i++) {
builder.append(nodes[i]).append(".");
if (!stub.equals(builder + Permission.PERMISSION_STAR.toString())) {
Expand All @@ -108,6 +109,7 @@ default int hasPermissionRange(
}
}
}
// Wildcard check for the full permission
if (hasPermission(stub + ".*")) {
return Integer.MAX_VALUE;
}
Expand Down

0 comments on commit 6de005b

Please sign in to comment.