i have noticed that Context.hasPrivilege receives so many calls and ends up evaluating to true most of the times at runtime with wrong privilege argument, has anyone encountered this?
2 Likes
Can you give an example or a unit test where this evaluates to true with the wrong privilege argument?
1 Like
o, there’s need to let privilegeListener know of the privilege
Hi @k.joseph I encountered a similar issue in the dhisconnector module.
To test that, I created a unit test like this:
@Test
public void testPrivileges(){
Assert.assertTrue(Context.hasPrivilege("FooBar"));
}
This test passed everytime even if there’s no privilege called “FooBar”.
Could you please help me to figure it out. Thanks in advance
1 Like
please check through if openmrs-core/AuthorizationAdviceTest.java at master · openmrs/openmrs-core · GitHub can be of help!
Thank you! @k.joseph . I’ll go through it and let you know the status.
1 Like