Search in sources :

Example 16 with ObjectDeltaListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType in project midpoint by Evolveum.

the class TestWSSecurity method test140AssignRoleToDarthAdderAsAdministrator.

@Test
public void test140AssignRoleToDarthAdderAsAdministrator() throws Exception {
    final String TEST_NAME = "test140AssignRoleToDarthAdderAsAdministrator";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort();
    ObjectDeltaListType deltaList = ModelClientUtil.createAssignDeltaList(UserType.class, USER_DARTHADDER_OID, RoleType.class, ROLE_MODIFIER_OID);
    // WHEN
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);
    // THEN
    assertSuccess(deltaOpList);
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "MODIFY_OBJECT");
    tailer.assertAudit(4);
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) Test(org.testng.annotations.Test)

Example 17 with ObjectDeltaListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType in project midpoint by Evolveum.

the class TestWSSecurity method test133ModifyConfigAsSomebody.

@Test
public void test133ModifyConfigAsSomebody() throws Exception {
    final String TEST_NAME = "test133ModifyConfigAsSomebody";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    ObjectReferenceType ref = new ObjectReferenceType();
    // fake
    ref.setOid("c4e998e6-d903-11e4-9aaf-001e8c717e5b");
    ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), "globalSecurityPolicyRef", ModificationTypeType.REPLACE, ref);
    try {
        // WHEN
        modelPort.executeChanges(deltaList, null);
        AssertJUnit.fail("Unexpected success");
    } catch (SOAPFaultException e) {
        assertSoapFault(e, "FailedAuthentication", "could not be authenticated or authorized");
    }
    // THEN
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "MODIFY_OBJECT", OperationResultStatusType.FATAL_ERROR, "not authorized");
    tailer.assertAudit(4);
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) Test(org.testng.annotations.Test)

Example 18 with ObjectDeltaListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType in project midpoint by Evolveum.

the class TestWSSecurity method test141ModifyTitleAsDarthAdder.

@Test
public void test141ModifyTitleAsDarthAdder() throws Exception {
    final String TEST_NAME = "test141ModifyTitleAsDarthAdder";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD, WSConstants.PW_DIGEST);
    ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(UserType.class, USER_DARTHADDER_OID, "title", ModificationTypeType.REPLACE, ModelClientUtil.createPolyStringType("Dark Lord"));
    // WHEN
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);
    // THEN
    assertSuccess(deltaOpList);
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "MODIFY_OBJECT");
    tailer.assertAudit(4);
    UserType user = getObject(UserType.class, USER_DARTHADDER_OID);
    PolyStringType title = user.getTitle();
    assertEquals("Wrong title", "Dark Lord", ModelClientUtil.getOrig(title));
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 19 with ObjectDeltaListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType in project midpoint by Evolveum.

the class TestWSSecurity method test135AssignRoleAsDarthAdder.

@Test
public void test135AssignRoleAsDarthAdder() throws Exception {
    final String TEST_NAME = "test135ModifyConfigAsDarthAdder";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    ObjectDeltaListType deltaList = ModelClientUtil.createAssignDeltaList(UserType.class, USER_DARTHADDER_OID, RoleType.class, ROLE_MODIFIER_OID);
    try {
        // WHEN
        modelPort.executeChanges(deltaList, null);
        AssertJUnit.fail("Unexpected success");
    } catch (SOAPFaultException e) {
        assertSoapFault(e, "FailedAuthentication", "could not be authenticated or authorized");
    }
    // THEN
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "MODIFY_OBJECT", OperationResultStatusType.FATAL_ERROR, "not authorized");
    tailer.assertAudit(4);
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) Test(org.testng.annotations.Test)

Example 20 with ObjectDeltaListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType in project midpoint by Evolveum.

the class Main method deleteUser.

private static void deleteUser(ModelPortType modelPort, String oid) throws FaultMessage {
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(UserType.class));
    deltaType.setChangeType(ChangeTypeType.DELETE);
    deltaType.setOid(oid);
    ObjectDeltaListType deltaListType = new ObjectDeltaListType();
    deltaListType.getDelta().add(deltaType);
    ModelExecuteOptionsType executeOptionsType = new ModelExecuteOptionsType();
    executeOptionsType.setRaw(true);
    modelPort.executeChanges(deltaListType, executeOptionsType);
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ModelExecuteOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Aggregations

ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)52 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)37 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)31 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)17 Test (org.testng.annotations.Test)17 LogfileTestTailer (com.evolveum.midpoint.test.util.LogfileTestTailer)13 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)11 ModelExecuteOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType)10 ObjectDeltaOperationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType)8 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)4 RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)4 FaultMessage (com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage)4 QName (javax.xml.namespace.QName)4 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)4 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)3 Task (com.evolveum.midpoint.task.api.Task)3 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)3 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)3 Collection (java.util.Collection)3 Document (org.w3c.dom.Document)3