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