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