Skip to content

Commit a13ba2f

Browse files
authored
feat: allow RBAC g policy to have more than 4 elements (#350)
1 parent fa605df commit a13ba2f

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/main/java/org/casbin/jcasbin/model/Assertion.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,7 @@ protected void buildRoleLinks(RoleManager rm) {
5555
if (rule.size() < count) {
5656
throw new IllegalArgumentException("grouping policy elements do not meet role definition");
5757
}
58-
59-
if (count == 2) {
60-
rm.addLink(rule.get(0), rule.get(1));
61-
} else if (count == 3) {
62-
rm.addLink(rule.get(0), rule.get(1), rule.get(2));
63-
} else if (count == 4) {
64-
rm.addLink(rule.get(0), rule.get(1), rule.get(2), rule.get(3));
65-
}
58+
rm.addLink(rule.get(0), rule.get(1), rule.subList(2, rule.size()).toArray(new String[0]));
6659
}
6760

6861
Util.logPrint("Role links for: " + key);

0 commit comments

Comments
 (0)