Search in sources :

Example 36 with ProvisioningException

use of eu.bcvsolutions.idm.acc.exception.ProvisioningException in project CzechIdMng by bcvsolutions.

the class DefaultSynchronizationService method process.

/**
 * Called from long running task
 */
@Override
public AbstractSysSyncConfigDto process() {
    AbstractSysSyncConfigDto config = synchronizationConfigService.get(synchronizationConfigId);
    // 
    if (config == null) {
        throw new ProvisioningException(AccResultCode.SYNCHRONIZATION_NOT_FOUND, ImmutableMap.of("id", synchronizationConfigId));
    }
    SysSystemMappingDto mapping = systemMappingService.get(config.getSystemMapping());
    Assert.notNull(mapping);
    SystemEntityType entityType = mapping.getEntityType();
    SynchronizationEntityExecutor executor = getSyncExecutor(entityType);
    executor.setLongRunningTaskExecutor(this);
    return executor.process(synchronizationConfigId);
}
Also used : SynchronizationEntityExecutor(eu.bcvsolutions.idm.acc.service.api.SynchronizationEntityExecutor) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)

Example 37 with ProvisioningException

use of eu.bcvsolutions.idm.acc.exception.ProvisioningException in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningBreakConfigService method save.

@Override
public SysProvisioningBreakConfigDto save(SysProvisioningBreakConfigDto dto, BasePermission... permission) {
    // check global configuration
    if (dto.getGlobalConfiguration() != null && dto.getGlobalConfiguration()) {
        throw new ProvisioningException(AccResultCode.PROVISIONING_BREAK_GLOBAL_CONFIG_SAVE, ImmutableMap.of("operationType", dto.getOperationType()));
    }
    // check if for same system doesn't exist same operation type
    SysProvisioningBreakConfigFilter filter = new SysProvisioningBreakConfigFilter();
    filter.setSystemId(dto.getSystem());
    filter.setOperationType(dto.getOperationType());
    List<SysProvisioningBreakConfigDto> similarConfigs = this.find(filter, null).getContent();
    boolean existSimilar = similarConfigs.stream().filter(config -> !config.getId().equals(dto.getId())).findFirst().isPresent();
    if (!existSimilar) {
        return super.save(dto, permission);
    }
    throw new ProvisioningException(AccResultCode.PROVISIONING_BREAK_OPERATION_EXISTS, ImmutableMap.of("operationType", dto.getOperationType(), "systemId", dto.getSystem()));
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) SysProvisioningBreakConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningBreakConfigFilter)

Example 38 with ProvisioningException

use of eu.bcvsolutions.idm.acc.exception.ProvisioningException in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemAttributeMappingService method getUidValueFromResource.

@Override
public String getUidValueFromResource(List<IcAttribute> icAttributes, List<SysSystemAttributeMappingDto> mappedAttributes, SysSystemDto system) {
    SysSystemAttributeMappingDto uidAttribute = this.getUidAttribute(mappedAttributes, system);
    Object uid = this.getValueByMappedAttribute(uidAttribute, icAttributes);
    if (uid == null) {
        SysSystemDto systemEntity = getSystemFromAttributeMapping(uidAttribute);
        throw new ProvisioningException(AccResultCode.PROVISIONING_GENERATED_UID_IS_NULL, ImmutableMap.of("system", systemEntity.getName()));
    }
    if (!(uid instanceof String)) {
        SysSystemDto systemEntity = getSystemFromAttributeMapping(uidAttribute);
        throw new ProvisioningException(AccResultCode.PROVISIONING_ATTRIBUTE_UID_IS_NOT_STRING, ImmutableMap.of("uid", uid.getClass(), "system", systemEntity.getName()));
    }
    return (String) uid;
}
Also used : SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 39 with ProvisioningException

use of eu.bcvsolutions.idm.acc.exception.ProvisioningException in project CzechIdMng by bcvsolutions.

the class IdentitySynchronizationExecutor method findByAttribute.

@Override
protected IdmIdentityDto findByAttribute(String idmAttributeName, String value) {
    CorrelationFilter filter = getEntityFilter();
    filter.setProperty(idmAttributeName);
    filter.setValue(value);
    List<IdmIdentityDto> entities = identityService.find((IdmIdentityFilter) filter, null).getContent();
    if (CollectionUtils.isEmpty(entities)) {
        return null;
    }
    if (entities.size() > 1) {
        throw new ProvisioningException(AccResultCode.SYNCHRONIZATION_CORRELATION_TO_MANY_RESULTS, ImmutableMap.of("correlationAttribute", idmAttributeName, "value", value));
    }
    if (entities.size() == 1) {
        return entities.get(0);
    }
    return null;
}
Also used : CorrelationFilter(eu.bcvsolutions.idm.core.api.dto.filter.CorrelationFilter) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)

Example 40 with ProvisioningException

use of eu.bcvsolutions.idm.acc.exception.ProvisioningException in project CzechIdMng by bcvsolutions.

the class RoleCatalogueProvisioningExecutor method getAttributeValue.

@Override
protected Object getAttributeValue(String uid, IdmRoleCatalogueDto dto, AttributeMapping attribute) {
    Object idmValue = super.getAttributeValue(uid, dto, attribute);
    if (attribute.isEntityAttribute() && TreeSynchronizationExecutor.PARENT_FIELD.equals(attribute.getIdmPropertyName())) {
        // parent format (UID of parent)
        if (idmValue instanceof UUID) {
            // Generally we expect IdmRoleCatalogue as parent (we will do
            // transform)
            AccRoleCatalogueAccountFilter catalogueAccountFilter = new AccRoleCatalogueAccountFilter();
            catalogueAccountFilter.setSystemId(this.getSytemFromSchemaAttribute(attribute.getSchemaAttribute()).getId());
            catalogueAccountFilter.setEntityId((UUID) idmValue);
            List<AccRoleCatalogueAccountDto> treeAccounts = catalogueAccountService.find(catalogueAccountFilter, null).getContent();
            if (treeAccounts.isEmpty()) {
                throw new ProvisioningException(AccResultCode.PROVISIONING_TREE_PARENT_ACCOUNT_NOT_FOUND, ImmutableMap.of("parentNode", idmValue));
            }
            if (treeAccounts.size() != 1) {
                throw new ProvisioningException(AccResultCode.PROVISIONING_TREE_TOO_MANY_PARENT_ACCOUNTS, ImmutableMap.of("parentNode", idmValue));
            }
            AccRoleCatalogueAccountDto treeAccount = treeAccounts.get(0);
            String parentUid = accountService.get(treeAccount.getAccount()).getUid();
            return parentUid;
        } else {
            // without any transform
            return idmValue;
        }
    }
    return idmValue;
}
Also used : ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) AccRoleCatalogueAccountDto(eu.bcvsolutions.idm.acc.dto.AccRoleCatalogueAccountDto) UUID(java.util.UUID) AccRoleCatalogueAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccRoleCatalogueAccountFilter)

Aggregations

ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)41 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)20 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)19 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)17 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)16 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)15 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)14 IcConnectorConfiguration (eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration)14 List (java.util.List)13 UUID (java.util.UUID)13 ImmutableMap (com.google.common.collect.ImmutableMap)12 AccResultCode (eu.bcvsolutions.idm.acc.domain.AccResultCode)12 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)12 SysSchemaObjectClassService (eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService)12 SysSystemAttributeMappingService (eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService)12 SysSystemMappingService (eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService)12 ArrayList (java.util.ArrayList)12 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)11 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)11 SysSchemaAttributeService (eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService)11