Search in sources :

Example 1 with RunAsCapabilityType

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

the class ConnIdCapabilitiesAndSchemaParser method processUpdateOperationOptions.

private void processUpdateOperationOptions(Set<OperationOptionInfo> supportedOptions) {
    boolean canRunAsUser = false;
    for (OperationOptionInfo searchOption : supportedOptions) {
        // noinspection SwitchStatementWithTooFewBranches
        switch(searchOption.getName()) {
            case OperationOptions.OP_RUN_AS_USER:
                canRunAsUser = true;
                break;
        }
    }
    if (canRunAsUser) {
        RunAsCapabilityType capRunAs = new RunAsCapabilityType();
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createRunAs(capRunAs));
    }
}
Also used : OperationOptionInfo(org.identityconnectors.framework.common.objects.OperationOptionInfo) RunAsCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.RunAsCapabilityType)

Example 2 with RunAsCapabilityType

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

the class CommonHelper method createConnectorOperationOptions.

ConnectorOperationOptions createConnectorOperationOptions(ProvisioningContext ctx, ProvisioningOperationOptions options, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, ExpressionEvaluationException {
    if (options == null) {
        return null;
    }
    String runAsAccountOid = options.getRunAsAccountOid();
    if (runAsAccountOid == null) {
        return null;
    }
    RunAsCapabilityType capRunAs = ctx.getEffectiveCapability(RunAsCapabilityType.class);
    if (capRunAs == null) {
        LOGGER.trace("Operation runAs requested, but resource does not have the capability. Ignoring runAs");
        return null;
    }
    PrismObject<ShadowType> runAsShadow;
    try {
        runAsShadow = shadowManager.getShadow(runAsAccountOid, result);
    } catch (ObjectNotFoundException e) {
        throw new ConfigurationException("Requested non-existing 'runAs' shadow", e);
    }
    ProvisioningContext runAsCtx = ctxFactory.createForShadow(runAsShadow, ctx.getResource(), ctx.getTask());
    shadowCaretaker.applyAttributesDefinition(runAsCtx, runAsShadow);
    ResourceObjectIdentification runAsIdentification = ResourceObjectIdentification.createFromShadow(runAsCtx.getObjectDefinitionRequired(), runAsShadow.asObjectable());
    ConnectorOperationOptions connOptions = new ConnectorOperationOptions();
    LOGGER.trace("RunAs identification: {}", runAsIdentification);
    connOptions.setRunAsIdentification(runAsIdentification);
    return connOptions;
}
Also used : ProvisioningContext(com.evolveum.midpoint.provisioning.impl.ProvisioningContext) ResourceObjectIdentification(com.evolveum.midpoint.schema.processor.ResourceObjectIdentification) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) RunAsCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.RunAsCapabilityType) ConnectorOperationOptions(com.evolveum.midpoint.provisioning.ucf.api.ConnectorOperationOptions)

Aggregations

RunAsCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.RunAsCapabilityType)2 ProvisioningContext (com.evolveum.midpoint.provisioning.impl.ProvisioningContext)1 ConnectorOperationOptions (com.evolveum.midpoint.provisioning.ucf.api.ConnectorOperationOptions)1 ResourceObjectIdentification (com.evolveum.midpoint.schema.processor.ResourceObjectIdentification)1 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)1 OperationOptionInfo (org.identityconnectors.framework.common.objects.OperationOptionInfo)1