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);
}
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;
}
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;
}
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);
}
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);
}
Aggregations