use of com.evolveum.midpoint.model.api.RoleSelectionSpecification in project midpoint by Evolveum.
the class TestSecurityBasic method test276AutzJackAssignRequestableRolesWithOrgRef.
/**
* MID-3136
*/
@Test
public void test276AutzJackAssignRequestableRolesWithOrgRef() throws Exception {
final String TEST_NAME = "test276AutzJackAssignRequestableRolesWithOrgRef";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
cleanupAutzTest(USER_JACK_OID);
assignRole(USER_JACK_OID, ROLE_ASSIGN_REQUESTABLE_ROLES_OID);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.RELATIVE);
login(USER_JACK_USERNAME);
// WHEN
TestUtil.displayWhen(TEST_NAME);
assertReadAllow(NUMBER_OF_ALL_USERS + 1);
assertAddDeny();
assertModifyDeny();
assertDeleteDeny();
PrismObject<UserType> user = getUser(USER_JACK_OID);
assertAssignments(user, 2);
assertAssignedRole(user, ROLE_ASSIGN_REQUESTABLE_ROLES_OID);
assertAllow("assign business role to jack", (task, result) -> assignPrametricRole(USER_JACK_OID, ROLE_BUSINESS_1_OID, ORG_MINISTRY_OF_RUM_OID, null, task, result));
user = getUser(USER_JACK_OID);
assertAssignments(user, 3);
assertAssignedRole(user, ROLE_BUSINESS_1_OID);
assertDeny("assign application role to jack", (task, result) -> assignRole(USER_JACK_OID, ROLE_BUSINESS_2_OID, task, result));
assertAllow("unassign business role from jack", (task, result) -> unassignPrametricRole(USER_JACK_OID, ROLE_BUSINESS_1_OID, ORG_MINISTRY_OF_RUM_OID, null, task, result));
user = getUser(USER_JACK_OID);
display("user after (expected 2 assignments)", user);
assertAssignments(user, 2);
RoleSelectionSpecification spec = getAssignableRoleSpecification(getUser(USER_JACK_OID));
assertRoleTypes(spec);
assertFilter(spec.getFilter(), TypeFilter.class);
assertGlobalStateUntouched();
}
use of com.evolveum.midpoint.model.api.RoleSelectionSpecification in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method getAssignableRoleSpecification.
protected <F extends FocusType> RoleSelectionSpecification getAssignableRoleSpecification(PrismObject<F> focus) throws ObjectNotFoundException, SchemaException, ConfigurationException {
OperationResult result = new OperationResult(AbstractIntegrationTest.class.getName() + ".getAssignableRoleSpecification");
RoleSelectionSpecification spec = modelInteractionService.getAssignableRoleSpecification(focus, result);
result.computeStatus();
TestUtil.assertSuccess(result);
return spec;
}
Aggregations