Search in sources :

Example 16 with ActivationCapabilityType

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType in project midpoint by Evolveum.

the class ConnIdCapabilitiesAndSchemaParser method updateCapabilitiesFromSchema.

private void updateCapabilitiesFromSchema(@NotNull Schema connIdSchema, SpecialAttributes specialAttributes) {
    ActivationCapabilityType capAct = null;
    if (specialAttributes.enableAttributeInfo != null) {
        capAct = new ActivationCapabilityType();
        ActivationStatusCapabilityType capActStatus = new ActivationStatusCapabilityType();
        capAct.setStatus(capActStatus);
        if (!specialAttributes.enableAttributeInfo.isReturnedByDefault()) {
            capActStatus.setReturnedByDefault(false);
        }
    }
    if (specialAttributes.enableDateAttributeInfo != null) {
        if (capAct == null) {
            capAct = new ActivationCapabilityType();
        }
        ActivationValidityCapabilityType capValidFrom = new ActivationValidityCapabilityType();
        capAct.setValidFrom(capValidFrom);
        if (!specialAttributes.enableDateAttributeInfo.isReturnedByDefault()) {
            capValidFrom.setReturnedByDefault(false);
        }
    }
    if (specialAttributes.disableDateAttributeInfo != null) {
        if (capAct == null) {
            capAct = new ActivationCapabilityType();
        }
        ActivationValidityCapabilityType capValidTo = new ActivationValidityCapabilityType();
        capAct.setValidTo(capValidTo);
        if (!specialAttributes.disableDateAttributeInfo.isReturnedByDefault()) {
            capValidTo.setReturnedByDefault(false);
        }
    }
    if (specialAttributes.lockoutAttributeInfo != null) {
        if (capAct == null) {
            capAct = new ActivationCapabilityType();
        }
        ActivationLockoutStatusCapabilityType capActStatus = new ActivationLockoutStatusCapabilityType();
        capAct.setLockoutStatus(capActStatus);
        if (!specialAttributes.lockoutAttributeInfo.isReturnedByDefault()) {
            capActStatus.setReturnedByDefault(false);
        }
    }
    // TODO: activation and credentials should be per-objectclass capabilities
    if (capAct != null) {
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createActivation(capAct));
    }
    if (specialAttributes.passwordAttributeInfo != null) {
        CredentialsCapabilityType capCred = new CredentialsCapabilityType();
        PasswordCapabilityType capPass = new PasswordCapabilityType();
        if (!specialAttributes.passwordAttributeInfo.isReturnedByDefault()) {
            capPass.setReturnedByDefault(false);
        }
        if (specialAttributes.passwordAttributeInfo.isReadable()) {
            capPass.setReadable(true);
        }
        capCred.setPassword(capPass);
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createCredentials(capCred));
    }
    if (specialAttributes.auxiliaryObjectClassAttributeInfo != null) {
        AuxiliaryObjectClassesCapabilityType capAux = new AuxiliaryObjectClassesCapabilityType();
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createAuxiliaryObjectClasses(capAux));
    }
    boolean canPageSize = false;
    boolean canPageOffset = false;
    boolean canSort = false;
    boolean supportsReturnDefaultAttributes = false;
    for (OperationOptionInfo searchOption : connIdSchema.getSupportedOptionsByOperation(SearchApiOp.class)) {
        switch(searchOption.getName()) {
            case OperationOptions.OP_PAGE_SIZE:
                canPageSize = true;
                break;
            case OperationOptions.OP_PAGED_RESULTS_OFFSET:
                canPageOffset = true;
                break;
            case OperationOptions.OP_SORT_KEYS:
                canSort = true;
                break;
            case OperationOptions.OP_RETURN_DEFAULT_ATTRIBUTES:
                supportsReturnDefaultAttributes = true;
                break;
        }
    }
    if (canPageSize || canPageOffset || canSort) {
        PagedSearchCapabilityType capPage = new PagedSearchCapabilityType();
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createPagedSearch(capPage));
    }
    if (connIdSupportedOperations.contains(GetApiOp.class) || connIdSupportedOperations.contains(SearchApiOp.class)) {
        ReadCapabilityType capRead = new ReadCapabilityType();
        capRead.setReturnDefaultAttributesOption(supportsReturnDefaultAttributes);
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createRead(capRead));
    }
    if (connIdSupportedOperations.contains(UpdateDeltaApiOp.class)) {
        processUpdateOperationOptions(connIdSchema.getSupportedOptionsByOperation(UpdateDeltaApiOp.class));
    } else if (connIdSupportedOperations.contains(UpdateApiOp.class)) {
        processUpdateOperationOptions(connIdSchema.getSupportedOptionsByOperation(UpdateApiOp.class));
    }
}
Also used : UpdateApiOp(org.identityconnectors.framework.api.operations.UpdateApiOp) ActivationLockoutStatusCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationLockoutStatusCapabilityType) ReadCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType) PasswordCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PasswordCapabilityType) ActivationCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType) GetApiOp(org.identityconnectors.framework.api.operations.GetApiOp) SearchApiOp(org.identityconnectors.framework.api.operations.SearchApiOp) AuxiliaryObjectClassesCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.AuxiliaryObjectClassesCapabilityType) PagedSearchCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PagedSearchCapabilityType) OperationOptionInfo(org.identityconnectors.framework.common.objects.OperationOptionInfo) ActivationValidityCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationValidityCapabilityType) CredentialsCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CredentialsCapabilityType) UpdateDeltaApiOp(org.identityconnectors.framework.api.operations.UpdateDeltaApiOp) ActivationStatusCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)

Example 17 with ActivationCapabilityType

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType in project midpoint by Evolveum.

the class AbstractManualConnectorInstance method fetchCapabilities.

@Override
public Collection<Object> fetchCapabilities(OperationResult parentResult) {
    Collection<Object> capabilities = new ArrayList<>();
    InternalMonitor.recordConnectorOperation("capabilities");
    // caching-only read capabilities
    ReadCapabilityType readCap = new ReadCapabilityType();
    readCap.setCachingOnly(true);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createRead(readCap));
    CreateCapabilityType createCap = new CreateCapabilityType();
    setManual(createCap);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createCreate(createCap));
    UpdateCapabilityType updateCap = new UpdateCapabilityType();
    updateCap.setAddRemoveAttributeValues(true);
    setManual(updateCap);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createUpdate(updateCap));
    DeleteCapabilityType deleteCap = new DeleteCapabilityType();
    setManual(deleteCap);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createDelete(deleteCap));
    ActivationCapabilityType activationCap = new ActivationCapabilityType();
    ActivationStatusCapabilityType activationStatusCap = new ActivationStatusCapabilityType();
    activationCap.setStatus(activationStatusCap);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createActivation(activationCap));
    CredentialsCapabilityType credentialsCap = new CredentialsCapabilityType();
    PasswordCapabilityType passwordCapabilityType = new PasswordCapabilityType();
    credentialsCap.setPassword(passwordCapabilityType);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createCredentials(credentialsCap));
    return capabilities;
}
Also used : UpdateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.UpdateCapabilityType) ReadCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType) DeleteCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.DeleteCapabilityType) PasswordCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PasswordCapabilityType) ActivationCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType) CredentialsCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CredentialsCapabilityType) ArrayList(java.util.ArrayList) PrismObject(com.evolveum.midpoint.prism.PrismObject) ActivationStatusCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType) CreateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType)

Example 18 with ActivationCapabilityType

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType in project midpoint by Evolveum.

the class TestOpenLdap method assertActivationCapability.

@Override
protected void assertActivationCapability(ActivationCapabilityType activationCapabilityType) {
    assertNotNull("No activation capability", activationCapabilityType);
    ActivationLockoutStatusCapabilityType lockoutCapability = CapabilityUtil.getEnabledActivationLockoutStatus(activationCapabilityType);
    assertNotNull("No lockout capability", lockoutCapability);
    displayValue("Lockout capability", lockoutCapability);
}
Also used : ActivationLockoutStatusCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationLockoutStatusCapabilityType)

Example 19 with ActivationCapabilityType

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType in project midpoint by Evolveum.

the class ResourceManager method adjustSchemaForSimulatedCapabilities.

/**
 * Adjust scheme with respect to capabilities. E.g. disable attributes that
 * are used for special purpose (such as account activation simulation).
 *
 * TODO treat also objectclass-specific capabilities here
 *
 * @return The updated schema (may be cloned if necessary)
 */
private ResourceSchema adjustSchemaForSimulatedCapabilities(PrismObject<ResourceType> resource, ResourceSchema rawSchema) {
    ResourceType resourceType = resource.asObjectable();
    if (resourceType.getCapabilities() == null || resourceType.getCapabilities().getConfigured() == null) {
        return rawSchema;
    }
    ActivationCapabilityType activationCapability = CapabilityUtil.getCapability(resourceType.getCapabilities().getConfigured().getAny(), ActivationCapabilityType.class);
    if (CapabilityUtil.getEnabledActivationStatus(activationCapability) != null) {
        QName attributeName = activationCapability.getStatus().getAttribute();
        Boolean ignore = activationCapability.getStatus().isIgnoreAttribute();
        if (attributeName != null && !Boolean.FALSE.equals(ignore)) {
            rawSchema = setAttributeIgnored(resource, rawSchema, attributeName);
        }
    }
    return rawSchema;
}
Also used : ActivationCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType) QName(javax.xml.namespace.QName)

Example 20 with ActivationCapabilityType

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType in project midpoint by Evolveum.

the class ActivationConverter method completeActivation.

// region Resource object -> midPoint (simulating/native -> activation)
/**
 * Completes activation for fetched object by determining simulated values if necessary.
 */
void completeActivation(PrismObject<ShadowType> resourceObject, OperationResult result) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
    ShadowType resourceObjectBean = resourceObject.asObjectable();
    ActivationCapabilityType activationCapability = ctx.getEffectiveCapability(ActivationCapabilityType.class);
    if (!CapabilityUtil.isCapabilityEnabled(activationCapability) && resourceObjectBean.getActivation() == null) {
        LOGGER.trace("No activation capability and also no activation information in the resource object.");
        return;
    }
    ActivationStatusType activationStatus = determineActivationStatus(resourceObject, activationCapability, result);
    LockoutStatusType lockoutStatus = determineLockoutStatus(resourceObject, activationCapability, result);
    if (activationStatus != null || lockoutStatus != null) {
        if (resourceObjectBean.getActivation() == null) {
            resourceObjectBean.setActivation(new ActivationType(beans.prismContext));
        }
        resourceObjectBean.getActivation().setAdministrativeStatus(activationStatus);
        resourceObjectBean.getActivation().setLockoutStatus(lockoutStatus);
    } else {
        if (resourceObjectBean.getActivation() != null) {
            resourceObjectBean.getActivation().setAdministrativeStatus(null);
            resourceObjectBean.getActivation().setLockoutStatus(null);
        }
    }
}
Also used : ActivationCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)

Aggregations

ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)29 ActivationStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)16 ActivationLockoutStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationLockoutStatusCapabilityType)13 QName (javax.xml.namespace.QName)11 Test (org.testng.annotations.Test)9 PrismObject (com.evolveum.midpoint.prism.PrismObject)8 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)8 CredentialsCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CredentialsCapabilityType)8 CapabilityCollectionType (com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilityCollectionType)7 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)6 ActivationValidityCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationValidityCapabilityType)6 Task (com.evolveum.midpoint.task.api.Task)5 ReadCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType)5 SynchronizationPolicyDecision (com.evolveum.midpoint.model.api.context.SynchronizationPolicyDecision)4 ResourceAttributeDefinition (com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition)4 ResourceSchema (com.evolveum.midpoint.schema.processor.ResourceSchema)4 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)3 ObjectClassComplexTypeDefinition (com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition)3 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)3 CreateCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType)3