use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method modifyRoleDeleteInducement.
protected void modifyRoleDeleteInducement(String roleOid, long inducementId, boolean reconcileAffected, Task task) throws SchemaException, ObjectAlreadyExistsException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException {
if (task == null) {
task = createTask(AbstractModelIntegrationTest.class.getName() + ".modifyRoleDeleteInducement");
}
OperationResult result = task.getResult();
AssignmentType inducement = new AssignmentType();
inducement.setId(inducementId);
ObjectDelta<RoleType> roleDelta = ObjectDelta.createModificationDeleteContainer(RoleType.class, roleOid, RoleType.F_INDUCEMENT, prismContext, inducement);
ModelExecuteOptions options = new ModelExecuteOptions();
options.setReconcileAffected(reconcileAffected);
modelService.executeChanges(MiscSchemaUtil.createCollection(roleDelta), options, task, result);
result.computeStatus();
if (reconcileAffected) {
TestUtil.assertInProgressOrSuccess(result);
} else {
TestUtil.assertSuccess(result);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestRbac method test703JackModifyJudgeDeleteInducementHonorabilityRecompute.
@Test
public void test703JackModifyJudgeDeleteInducementHonorabilityRecompute() throws Exception {
final String TEST_NAME = "test703JackModifyJudgeDeleteInducementHonorabilityRecompute";
TestUtil.displayTestTile(this, TEST_NAME);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
modifyRoleDeleteInducementTarget(ROLE_JUDGE_OID, ROLE_HONORABILITY_OID);
PrismObject<RoleType> roleJudge = modelService.getObject(RoleType.class, ROLE_JUDGE_OID, null, task, result);
display("Role judge", roleJudge);
// WHEN
TestUtil.displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, ModelExecuteOptions.createReconcile(), task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
assertAssignedRole(USER_JACK_OID, ROLE_JUDGE_OID, task, result);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
assertDummyAccount(RESOURCE_DUMMY_RED_NAME, ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, false);
assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Honorable");
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestRbac method test010SearchReuqestableRoles.
@Test
public void test010SearchReuqestableRoles() throws Exception {
final String TEST_NAME = "test010SearchReuqestableRoles";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = QueryBuilder.queryFor(RoleType.class, prismContext).item(RoleType.F_REQUESTABLE).eq(true).build();
// WHEN
List<PrismObject<RoleType>> requestableRoles = modelService.searchObjects(RoleType.class, query, null, task, result);
// THEN
display("Requestable roles", requestableRoles);
assertEquals("Unexpected number of requestable roles", 3, requestableRoles.size());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestRbac method test827AddImmutableAssignRole.
/**
* This role has a metarole which has immutable policy rule in the
* inducement.
*/
@Test
public void test827AddImmutableAssignRole() throws Exception {
final String TEST_NAME = "test827AddImmutableAssignRole";
TestUtil.displayTestTile(this, TEST_NAME);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<RoleType> role = PrismTestUtil.parseObject(ROLE_IMMUTABLE_ASSIGN_FILE);
display("Role before", role);
try {
// WHEN
TestUtil.displayWhen(TEST_NAME);
addObject(role, task, result);
AssertJUnit.fail("Unexpected success");
} catch (PolicyViolationException e) {
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertFailure(result);
}
assertNoObject(RoleType.class, ROLE_IMMUTABLE_ASSIGN_OID);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestRbac method test000SanityRolePirate.
@Test
public void test000SanityRolePirate() throws Exception {
final String TEST_NAME = "test000SanityRolePirate";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
PrismObject<RoleType> rolePirate = modelService.getObject(RoleType.class, ROLE_PIRATE_OID, null, task, result);
// THEN
display("Role pirate", rolePirate);
IntegrationTestTools.displayXml("Role pirate", rolePirate);
assertNotNull("No pirate", rolePirate);
PrismAsserts.assertEquivalent(ROLE_PIRATE_FILE, rolePirate);
}
Aggregations