Search in sources :

Example 96 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class ConnIdToMidPointConversion method convertLockOut.

private void convertLockOut(Attribute connIdAttr) throws SchemaException {
    Boolean lockOut = getSingleValue(connIdAttr, Boolean.class);
    if (lockOut == null) {
        return;
    }
    ActivationType activation = ShadowUtil.getOrCreateActivation(resourceObjectBean);
    LockoutStatusType lockoutStatus;
    if (lockOut) {
        lockoutStatus = LockoutStatusType.LOCKED;
    } else {
        lockoutStatus = LockoutStatusType.NORMAL;
    }
    activation.setLockoutStatus(lockoutStatus);
    LOGGER.trace("Converted activation lockoutStatus: {}", lockoutStatus);
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) LockoutStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType)

Example 97 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class QAssignmentMapping method toSchemaObject.

@Override
public AssignmentType toSchemaObject(MAssignment row) {
    // TODO is there any place we can put row.ownerOid reasonably?
    // repositoryContext().prismContext().itemFactory().createObject(... definition?)
    // assignment.asPrismContainerValue().setParent(new ObjectType().oid(own)); abstract not possible
    // For assignments we can use ownerType, but this is not general for all containers.
    // Inspiration: com.evolveum.midpoint.repo.sql.helpers.CertificationCaseHelper.updateLoadedCertificationCase
    // (if even possible with abstract type definition)
    AssignmentType assignment = new AssignmentType().id(row.cid).lifecycleState(row.lifecycleState).order(row.orderValue).orgRef(objectReference(row.orgRefTargetOid, row.orgRefTargetType, row.orgRefRelationId)).targetRef(objectReference(row.targetRefTargetOid, row.targetRefTargetType, row.targetRefRelationId)).tenantRef(objectReference(row.tenantRefTargetOid, row.tenantRefTargetType, row.tenantRefRelationId));
    if (row.policySituations != null) {
        for (Integer policySituationId : row.policySituations) {
            assignment.policySituation(resolveIdToUri(policySituationId));
        }
    }
    if (row.subtypes != null) {
        for (String subtype : row.subtypes) {
            assignment.subtype(subtype);
        }
    }
    if (row.resourceRefTargetOid != null) {
        assignment.construction(new ConstructionType(prismContext()).resourceRef(objectReference(row.resourceRefTargetOid, row.resourceRefTargetType, row.resourceRefRelationId)));
    }
    ActivationType activation = new ActivationType(prismContext()).administrativeStatus(row.administrativeStatus).effectiveStatus(row.effectiveStatus).enableTimestamp(asXMLGregorianCalendar(row.enableTimestamp)).disableTimestamp(asXMLGregorianCalendar(row.disableTimestamp)).disableReason(row.disableReason).validityStatus(row.validityStatus).validFrom(asXMLGregorianCalendar(row.validFrom)).validTo(asXMLGregorianCalendar(row.validTo)).validityChangeTimestamp(asXMLGregorianCalendar(row.validityChangeTimestamp)).archiveTimestamp(asXMLGregorianCalendar(row.archiveTimestamp));
    if (!activation.asPrismContainerValue().isEmpty()) {
        assignment.activation(activation);
    }
    MetadataType metadata = new MetadataType(prismContext()).creatorRef(objectReference(row.creatorRefTargetOid, row.creatorRefTargetType, row.creatorRefRelationId)).createChannel(resolveIdToUri(row.createChannelId)).createTimestamp(asXMLGregorianCalendar(row.createTimestamp)).modifierRef(objectReference(row.modifierRefTargetOid, row.modifierRefTargetType, row.modifierRefRelationId)).modifyChannel(resolveIdToUri(row.modifyChannelId)).modifyTimestamp(asXMLGregorianCalendar(row.modifyTimestamp));
    if (!metadata.asPrismContainerValue().isEmpty()) {
        assignment.metadata(metadata);
    }
    return assignment;
}
Also used : ConstructionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)

Example 98 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class RActivation method toJAXB.

public ActivationType toJAXB(PrismContext prismContext) {
    ActivationType activation = new ActivationType();
    RActivation.copyToJAXB(this, activation, prismContext);
    return activation;
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)

Example 99 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class TestOpenLdap method test702LockOutBarbossa.

@Test
public void test702LockOutBarbossa() throws Exception {
    Entry entry = getLdapAccountByUid(USER_BARBOSSA_USERNAME);
    displayValue("LDAP Entry before", entry);
    // WHEN
    when();
    for (int i = 0; i < 10; i++) {
        try {
            ldapConnect(null, entry.getDn().toString(), "this password is wrong");
        } catch (SecurityException e) {
            // Good bad attempt
            continue;
        }
        assertNotReached();
    }
    // THEN
    then();
    entry = assertLdapAccount(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME);
    displayValue("LDAP Entry after", entry);
    PrismObject<ShadowType> shadow = getShadowModel(accountBarbossaOid);
    display("Shadow (model)", shadow);
    ActivationType activation = shadow.asObjectable().getActivation();
    assertNotNull("No activation", activation);
    LockoutStatusType lockoutStatus = shadow.asObjectable().getActivation().getLockoutStatus();
    assertEquals("Wrong lockout status", LockoutStatusType.LOCKED, lockoutStatus);
}
Also used : Entry(org.apache.directory.api.ldap.model.entry.Entry) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) LockoutStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType) Test(org.testng.annotations.Test)

Example 100 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class TestOpenLdap method test700CheckBarbossaLockoutStatus.

@Test
public void test700CheckBarbossaLockoutStatus() throws Exception {
    // WHEN
    when();
    PrismObject<ShadowType> shadow = getShadowModel(accountBarbossaOid);
    // THEN
    then();
    display("Shadow (model)", shadow);
    ActivationType activation = shadow.asObjectable().getActivation();
    if (activation != null) {
        LockoutStatusType lockoutStatus = shadow.asObjectable().getActivation().getLockoutStatus();
        if (lockoutStatus != null && lockoutStatus != LockoutStatusType.NORMAL) {
            AssertJUnit.fail("Barbossa is locked!");
        }
    }
    assertLdapPassword(USER_BARBOSSA_USERNAME, USER_BARBOSSA_PASSWORD_2);
}
Also used : ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) LockoutStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType) Test(org.testng.annotations.Test)

Aggregations

ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)76 Test (org.testng.annotations.Test)48 ActivationStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType)40 AbstractUnitTest (com.evolveum.midpoint.tools.testng.AbstractUnitTest)13 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)11 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)10 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)9 Task (com.evolveum.midpoint.task.api.Task)9 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)8 PrismObject (com.evolveum.midpoint.prism.PrismObject)7 MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)7 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)7 LockoutStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType)6 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)6 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)6 ActivationStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)5 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)4 TimeIntervalStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.TimeIntervalStatusType)4 ActivationLockoutStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationLockoutStatusCapabilityType)4 QName (javax.xml.namespace.QName)4