use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestRbac method test001SanityRoleProjectOmnimanager.
@Test
public void test001SanityRoleProjectOmnimanager() throws Exception {
final String TEST_NAME = "test001SanityRoleProjectOmnimanager";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
PrismObject<RoleType> roleOmnimanager = modelService.getObject(RoleType.class, ROLE_PROJECT_OMNINAMAGER_OID, null, task, result);
// THEN
display("Role omnimanager", roleOmnimanager);
IntegrationTestTools.displayXml("Role omnimanager", roleOmnimanager);
assertNotNull("No omnimanager", roleOmnimanager);
ObjectReferenceType targetRef = roleOmnimanager.asObjectable().getInducement().get(0).getTargetRef();
assertEquals("Wrong targetRef resolutionTime", EvaluationTimeType.RUN, targetRef.getResolutionTime());
assertNull("targetRef is resolved", targetRef.getOid());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestRbac method test826AddNonCreateableRole.
@Test
public void test826AddNonCreateableRole() throws Exception {
final String TEST_NAME = "test826AddNonCreateableRole";
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_NON_CREATEABLE_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_NON_CREATEABLE_OID);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestRbac method test804ModifyRoleImmutableGlobalIdentifier.
@Test
public void test804ModifyRoleImmutableGlobalIdentifier() throws Exception {
final String TEST_NAME = "test804ModifyRoleImmutableGlobalIdentifier";
TestUtil.displayTestTile(this, TEST_NAME);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
try {
// WHEN
TestUtil.displayWhen(TEST_NAME);
modifyObjectReplaceProperty(RoleType.class, ROLE_IMMUTABLE_GLOBAL_OID, RoleType.F_IDENTIFIER, task, result, "whatever");
AssertJUnit.fail("Unexpected success");
} catch (PolicyViolationException e) {
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertFailure(result);
}
PrismObject<RoleType> roleAfter = getObject(RoleType.class, ROLE_IMMUTABLE_GLOBAL_OID);
PrismAsserts.assertPropertyValue(roleAfter, RoleType.F_DESCRIPTION, ROLE_IMMUTABLE_GLOBAL_DESCRIPTION);
PrismAsserts.assertPropertyValue(roleAfter, RoleType.F_IDENTIFIER, ROLE_IMMUTABLE_GLOBAL_IDENTIFIER);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestRbac method test805ModifyRoleImmutableGlobalDescription.
@Test
public void test805ModifyRoleImmutableGlobalDescription() throws Exception {
final String TEST_NAME = "test805ModifyRoleImmutableGlobalDescription";
TestUtil.displayTestTile(this, TEST_NAME);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
try {
// WHEN
TestUtil.displayWhen(TEST_NAME);
modifyObjectReplaceProperty(RoleType.class, ROLE_IMMUTABLE_GLOBAL_OID, RoleType.F_DESCRIPTION, task, result, "whatever");
AssertJUnit.fail("Unexpected success");
} catch (PolicyViolationException e) {
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertFailure(result);
}
PrismObject<RoleType> roleAfter = getObject(RoleType.class, ROLE_IMMUTABLE_GLOBAL_OID);
PrismAsserts.assertPropertyValue(roleAfter, RoleType.F_DESCRIPTION, ROLE_IMMUTABLE_GLOBAL_DESCRIPTION);
PrismAsserts.assertPropertyValue(roleAfter, RoleType.F_IDENTIFIER, ROLE_IMMUTABLE_GLOBAL_IDENTIFIER);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method modifyRoleDeleteInducementTarget.
protected void modifyRoleDeleteInducementTarget(String roleOid, String targetOid) throws SchemaException, ObjectAlreadyExistsException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException {
Task task = createTask(AbstractModelIntegrationTest.class.getName() + ".modifyRoleDeleteInducementTarget");
OperationResult result = task.getResult();
AssignmentType inducement = findInducementByTarget(roleOid, targetOid);
ObjectDelta<RoleType> roleDelta = ObjectDelta.createModificationDeleteContainer(RoleType.class, roleOid, new ItemPath(new NameItemPathSegment(RoleType.F_INDUCEMENT)), prismContext, inducement.asPrismContainerValue().clone());
modelService.executeChanges(MiscSchemaUtil.createCollection(roleDelta), null, task, result);
result.computeStatus();
TestUtil.assertSuccess(result);
}
Aggregations