Closed unchai closed 3 years ago
@shink @shy1st
I had the same problem :( I will do it.
@hsluoyz @unchai
Should the correct result be like this?
System.out.println(enforcer.getRolesForUserInDomain("alice", "domain1")); // [admin]
System.out.println(enforcer.getRolesForUserInDomain("alice", "domain2")); // [admin]
System.out.println(enforcer.getRolesForUserInDomain("alice", "*")); // [admin]
System.out.println(enforcer.getRolesForUserInDomain("alice", "do*")); // [admin]
If so, I think you can use domain with pattern matching in the following way.
enforcer.setRoleManager(new DefaultRoleManager(10, null, BuiltInFunctions::keyMatch));
enforcer.loadPolicy();
System.out.println(enforcer.getRolesForUserInDomain("alice", "domain1")); // [admin]
System.out.println(enforcer.getRolesForUserInDomain("alice", "domain2")); // [admin]
System.out.println(enforcer.getRolesForUserInDomain("alice", "*")); // [admin]
System.out.println(enforcer.getRolesForUserInDomain("alice", "do*")); // [admin]
Looking forward to your suggestions.
Closed as resolved.
model.conf
policy.csv
Java code with spring-boot
Result
How can i use domain with pattern matching?