use of com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType in project midpoint by Evolveum.
the class TestMapping method test107ModifyAccountShipAgain.
@Test
public void test107ModifyAccountShipAgain() throws Exception {
final String TEST_NAME = "test107ModifyAccountShipAgain";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestMapping.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
dummyAuditService.clear();
PrismObject<UserType> userJack = getUser(USER_JACK_OID);
String accountOid = getSingleLinkOid(userJack);
Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<ObjectDelta<? extends ObjectType>>();
ObjectDelta<ShadowType> accountDelta = ObjectDelta.createModificationReplaceProperty(ShadowType.class, accountOid, dummyResourceCtlBlue.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME), prismContext, "HMS Dauntless");
deltas.add(accountDelta);
// WHEN
modelService.executeChanges(deltas, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
userJack = getUser(USER_JACK_OID);
display("User after change execution", userJack);
assertUserJack(userJack, "Captain Jack Sparrow", "Jack", "Sparrow");
assertAccountShip(userJack, "Jack Sparrow", "HMS Dauntless", dummyResourceCtlBlue, task);
// Check audit
display("Audit", dummyAuditService);
dummyAuditService.assertSimpleRecordSanity();
dummyAuditService.assertRecords(2);
dummyAuditService.assertAnyRequestDeltas();
dummyAuditService.assertExecutionDeltas(1);
dummyAuditService.assertHasDelta(ChangeType.MODIFY, ShadowType.class);
dummyAuditService.assertExecutionSuccess();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType in project midpoint by Evolveum.
the class TestMappingInbound method test110AddDummyTeaGreenAccountMancomb.
@Test
public void test110AddDummyTeaGreenAccountMancomb() throws Exception {
final String TEST_NAME = "test110AddDummyTeaGreenAccountMancomb";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TestMappingInbound.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// Preconditions
//assertUsers(5);
DummyAccount account = new DummyAccount(ACCOUNT_MANCOMB_DUMMY_USERNAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Mancomb Seepgood");
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Melee Island");
/// WHEN
TestUtil.displayWhen(TEST_NAME);
dummyResourceTeaGreen.addAccount(account);
waitForSyncTaskNextRun();
// THEN
TestUtil.displayThen(TEST_NAME);
PrismObject<ShadowType> accountMancomb = findAccountByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME, resourceDummyTeaGreen);
display("Account mancomb", accountMancomb);
assertNotNull("No mancomb account shadow", accountMancomb);
assertEquals("Wrong resourceRef in mancomb account", RESOURCE_DUMMY_TEA_GREEN_OID, accountMancomb.asObjectable().getResourceRef().getOid());
assertShadowOperationalData(accountMancomb, SynchronizationSituationType.LINKED, null);
PrismObject<UserType> userMancomb = findUserByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME);
display("User mancomb", userMancomb);
assertNotNull("User mancomb was not created", userMancomb);
assertLinks(userMancomb, 1);
assertAdministrativeStatusEnabled(userMancomb);
assertLinked(userMancomb, accountMancomb);
// assertUsers(6);
// notifications
notificationManager.setDisabled(true);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType in project midpoint by Evolveum.
the class TestMappingInbound method test150UserReconcile.
@Test
public void test150UserReconcile() throws Exception {
final String TEST_NAME = "test150UserReconcile";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TestMappingInbound.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
dummyAuditService.clear();
// Preconditions
//assertUsers(5);
/// WHEN
TestUtil.displayWhen(TEST_NAME);
PrismObject<UserType> userMancomb = findUserByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME);
assertNotNull("User mancomb has disappeared", userMancomb);
reconcileUser(userMancomb.getOid(), task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
PrismObject<ShadowType> accountMancomb = findAccountByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME, resourceDummyTeaGreen);
display("Account mancomb", accountMancomb);
assertNotNull("No mancomb account shadow", accountMancomb);
assertEquals("Wrong resourceRef in mancomb account", RESOURCE_DUMMY_TEA_GREEN_OID, accountMancomb.asObjectable().getResourceRef().getOid());
assertShadowOperationalData(accountMancomb, SynchronizationSituationType.LINKED, null);
userMancomb = findUserByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME);
display("User mancomb", userMancomb);
assertLinks(userMancomb, 1);
assertAdministrativeStatusEnabled(userMancomb);
assertLinked(userMancomb, accountMancomb);
// assertUsers(6);
// notifications
notificationManager.setDisabled(true);
display("Audit", dummyAuditService);
dummyAuditService.assertRecords(2);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType in project midpoint by Evolveum.
the class TestSecurityBasic method test258AutzJackSelfAccountsPartialControlPassword.
@Test
public void test258AutzJackSelfAccountsPartialControlPassword() throws Exception {
final String TEST_NAME = "test258AutzJackSelfAccountsPartialControlPassword";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
cleanupAutzTest(USER_JACK_OID);
assignRole(USER_JACK_OID, ROLE_SELF_ACCOUNTS_PARTIAL_CONTROL_PASSWORD_OID);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
login(USER_JACK_USERNAME);
// WHEN
TestUtil.displayWhen(TEST_NAME);
assertGetAllow(UserType.class, USER_JACK_OID);
assertGetDeny(UserType.class, USER_GUYBRUSH_OID);
assertAddDeny();
assertModifyAllow(UserType.class, USER_JACK_OID, UserType.F_NICK_NAME, PrismTestUtil.createPolyString("jackie"));
assertModifyDeny(UserType.class, USER_JACK_OID, UserType.F_HONORIFIC_PREFIX, PrismTestUtil.createPolyString("Captain"));
assertModifyDeny(UserType.class, USER_GUYBRUSH_OID, UserType.F_HONORIFIC_PREFIX, PrismTestUtil.createPolyString("Pirate"));
assertDeleteDeny();
assertDeleteDeny(UserType.class, USER_JACK_OID);
PrismObject<UserType> user = getUser(USER_JACK_OID);
String accountOid = getSingleLinkOid(user);
assertGetAllow(ShadowType.class, accountOid);
PrismObject<ShadowType> shadow = getObject(ShadowType.class, accountOid);
display("Jack's shadow", shadow);
RefinedObjectClassDefinition rOcDef = modelInteractionService.getEditObjectClassDefinition(shadow, getDummyResourceObject(), null);
display("Refined objectclass def", rOcDef);
assertAttributeFlags(rOcDef, SchemaConstants.ICFS_UID, true, false, false);
assertAttributeFlags(rOcDef, SchemaConstants.ICFS_NAME, true, false, false);
assertAttributeFlags(rOcDef, new QName("location"), true, true, true);
assertAttributeFlags(rOcDef, new QName("weapon"), true, false, false);
// Not linked to jack
assertGetDeny(ShadowType.class, ACCOUNT_SHADOW_ELAINE_DUMMY_OID);
// Not linked to jack
assertAddDeny(ACCOUNT_JACK_DUMMY_RED_FILE);
// Not even jack's account
assertAddDeny(ACCOUNT_GUYBRUSH_DUMMY_FILE);
ProtectedStringType passwordPs = new ProtectedStringType();
passwordPs.setClearValue("nbusr123");
assertModifyAllow(UserType.class, USER_JACK_OID, PASSWORD_PATH, passwordPs);
assertModifyDeny(UserType.class, USER_GUYBRUSH_OID, PASSWORD_PATH, passwordPs);
Task task = taskManager.createTaskInstance(TEST_NAME);
OperationResult result = task.getResult();
PrismObjectDefinition<UserType> rDef = modelInteractionService.getEditObjectDefinition(user, AuthorizationPhaseType.REQUEST, task, result);
assertItemFlags(rDef, PASSWORD_PATH, true, false, false);
assertGlobalStateUntouched();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType in project midpoint by Evolveum.
the class TestSecurityBasic method test256AutzJackSelfAccountsPartialControl.
@Test
public void test256AutzJackSelfAccountsPartialControl() throws Exception {
final String TEST_NAME = "test256AutzJackSelfAccountsPartialControl";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
cleanupAutzTest(USER_JACK_OID);
assignRole(USER_JACK_OID, ROLE_SELF_ACCOUNTS_PARTIAL_CONTROL_OID);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
login(USER_JACK_USERNAME);
// WHEN
TestUtil.displayWhen(TEST_NAME);
assertGetAllow(UserType.class, USER_JACK_OID);
assertGetDeny(UserType.class, USER_GUYBRUSH_OID);
assertAddDeny();
assertModifyAllow(UserType.class, USER_JACK_OID, UserType.F_NICK_NAME, PrismTestUtil.createPolyString("jackie"));
assertModifyDeny(UserType.class, USER_JACK_OID, UserType.F_HONORIFIC_PREFIX, PrismTestUtil.createPolyString("Captain"));
assertModifyDeny(UserType.class, USER_GUYBRUSH_OID, UserType.F_HONORIFIC_PREFIX, PrismTestUtil.createPolyString("Pirate"));
assertDeleteDeny();
assertDeleteDeny(UserType.class, USER_JACK_OID);
PrismObject<UserType> user = getUser(USER_JACK_OID);
String accountOid = getSingleLinkOid(user);
assertGetAllow(ShadowType.class, accountOid);
PrismObject<ShadowType> shadow = getObject(ShadowType.class, accountOid);
display("Jack's shadow", shadow);
RefinedObjectClassDefinition rOcDef = modelInteractionService.getEditObjectClassDefinition(shadow, getDummyResourceObject(), null);
display("Refined objectclass def", rOcDef);
assertAttributeFlags(rOcDef, SchemaConstants.ICFS_UID, true, false, false);
assertAttributeFlags(rOcDef, SchemaConstants.ICFS_NAME, true, false, false);
assertAttributeFlags(rOcDef, new QName("location"), true, true, true);
assertAttributeFlags(rOcDef, new QName("weapon"), true, false, false);
// Not linked to jack
assertGetDeny(ShadowType.class, ACCOUNT_SHADOW_ELAINE_DUMMY_OID);
// Not linked to jack
assertAddDeny(ACCOUNT_JACK_DUMMY_RED_FILE);
// Not even jack's account
assertAddDeny(ACCOUNT_GUYBRUSH_DUMMY_FILE);
ProtectedStringType passwordPs = new ProtectedStringType();
passwordPs.setClearValue("nbusr123");
assertModifyDeny(UserType.class, USER_JACK_OID, PASSWORD_PATH, passwordPs);
assertModifyDeny(UserType.class, USER_GUYBRUSH_OID, PASSWORD_PATH, passwordPs);
Task task = taskManager.createTaskInstance(TEST_NAME);
OperationResult result = task.getResult();
PrismObjectDefinition<UserType> rDef = modelInteractionService.getEditObjectDefinition(user, AuthorizationPhaseType.REQUEST, task, result);
assertItemFlags(rDef, PASSWORD_PATH, true, false, false);
// // Linked to jack
// assertAllow("add jack's account to jack", new Attempt() {
// @Override
// public void run(Task task, OperationResult result) throws Exception {
// modifyUserAddAccount(USER_JACK_OID, ACCOUNT_JACK_DUMMY_RED_FILE, task, result);
// }
// });
// user = getUser(USER_JACK_OID);
// display("Jack after red account link", user);
// String accountRedOid = getLinkRefOid(user, RESOURCE_DUMMY_RED_OID);
// assertNotNull("Strange, red account not linked to jack", accountRedOid);
//
// // Linked to other user
// assertDeny("add gyubrush's account", new Attempt() {
// @Override
// public void run(Task task, OperationResult result) throws Exception {
// modifyUserAddAccount(USER_LARGO_OID, ACCOUNT_HERMAN_DUMMY_FILE, task, result);
// }
// });
//
// assertDeleteAllow(ShadowType.class, accountRedOid);
// assertDeleteDeny(ShadowType.class, ACCOUNT_SHADOW_ELAINE_DUMMY_OID);
assertGlobalStateUntouched();
}
Aggregations