Closed Harishs27 closed 9 months ago
@tangyang9464 @imp2002
@Harishs27 can you answer these?
I have not upgraded to new versions of casbin. So i am not sure if its recurring issue with other versions as well
Run test testRoleAPIWithDomains()
in RbacAPIWithDomainsUnitTest.java
to test getRolesForUserInDomain()
, all as expected! The probability is that you are using it incorrectly, you can refer to the usage of the test.
Closed as resolved
My application is cloud based springboot app with multiple tenants/domain.
I have many policies present already in db for each tenants/domain. When i start the application the first thing we do is to wait for enforcer to load all the policies in memory. However we are not stopping the application if the enforcer is not ready. So we have a simple function to check if enforcer is ready by getting all the roles from DB by using the command, we try this for 5 times.
enforcer.getAllRoles().isEmpty();
Now the above command always gives empty result. And the application still goes ahead and starts.
So in this scenario when i am trying to get all the roles for the given user in given tenant using below function i am getting error.
public void getRolesForUser(String userId, String domain){ enforcer.getRolesForUserInDomain(userId, domain); }
The error i am getting is as below
10-01-2024 14:25:11.505|[http-nio-8080-exec-3]|[]|ERROR|org.casbin.jcasbin|error: name does not exist
Why is enforcer unable to load policies from DB.
The casbin version i'm using is 0.4.1