use of org.pentaho.platform.security.policy.rolebased.actions.AdministerSecurityAction in project pentaho-platform by pentaho.
the class AuthorizationActionServiceTest method testDoValidateAuth.
@Test
public void testDoValidateAuth() {
IAuthorizationPolicy policy = mock(IAuthorizationPolicy.class);
List<IAuthorizationAction> actions = new ArrayList();
actions.add(new AdministerSecurityAction());
doReturn(actions).when(authorizationActionService).getActionList();
doReturn(policy).when(authorizationActionService).getPolicy();
doReturn(true).when(policy).isAllowed("org.pentaho.security.administerSecurity");
boolean isAllowed = authorizationActionService.validateAuth("org.pentaho.security.administerSecurity");
assertEquals(isAllowed, true);
isAllowed = authorizationActionService.validateAuth("invalid-auth");
assertEquals(isAllowed, false);
}
Aggregations