Search in sources :

Example 1 with EntityAccountFilter

use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.

the class RoleSynchronizationExecutor method doUnlink.

/**
 * Operation remove RoleAccount relations and linked roles
 *
 * @param account
 * @param removeRoleRole
 * @param log
 * @param logItem
 * @param actionLogs
 */
protected void doUnlink(AccAccountDto account, boolean removeRoleRole, SysSyncLogDto log, SysSyncItemLogDto logItem, List<SysSyncActionLogDto> actionLogs) {
    EntityAccountFilter roleAccountFilter = new AccRoleAccountFilter();
    roleAccountFilter.setAccountId(account.getId());
    List<AccRoleAccountDto> roleAccounts = roleAccoutnService.find((AccRoleAccountFilter) roleAccountFilter, null).getContent();
    if (roleAccounts.isEmpty()) {
        addToItemLog(logItem, "Role account relation was not found!");
        initSyncActionLog(SynchronizationActionType.UPDATE_ENTITY, OperationResultType.WARNING, logItem, log, actionLogs);
        return;
    }
    addToItemLog(logItem, MessageFormat.format("Role-account relations to delete {0}", roleAccounts));
    roleAccounts.stream().forEach(roleAccount -> {
        // We will remove role account, but without delete connected
        // account
        roleAccoutnService.delete(roleAccount, false);
        addToItemLog(logItem, MessageFormat.format("Role-account relation deleted (without call delete provisioning) (username: {0}, id: {1})", roleAccount.getRole(), roleAccount.getId()));
    });
    return;
}
Also used : EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter) AccRoleAccountDto(eu.bcvsolutions.idm.acc.dto.AccRoleAccountDto) AccRoleAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccRoleAccountFilter)

Example 2 with EntityAccountFilter

use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.

the class AbstractProvisioningExecutor method resolveMappedAttributes.

/**
 * Return all mapped attributes for this account (include overloaded
 * attributes)
 *
 * @param uid
 * @param account
 * @param entity
 * @param system
 * @param entityType
 * @return
 */
@Override
public List<AttributeMapping> resolveMappedAttributes(AccAccountDto account, DTO dto, SysSystemDto system, SystemEntityType entityType) {
    EntityAccountFilter filter = this.createEntityAccountFilter();
    filter.setEntityId(dto.getId());
    filter.setSystemId(system.getId());
    filter.setOwnership(Boolean.TRUE);
    filter.setAccountId(account.getId());
    List<? extends EntityAccountDto> entityAccoutnList = this.getEntityAccountService().find(filter, null).getContent();
    if (entityAccoutnList == null) {
        return null;
    }
    // All identity account with flag ownership on true
    // All role system attributes (overloading) for this uid and same system
    List<SysRoleSystemAttributeDto> roleSystemAttributesAll = findOverloadingAttributes(dto, system, entityAccoutnList, entityType);
    // All default mapped attributes from system
    List<? extends AttributeMapping> defaultAttributes = findAttributeMappings(system, entityType);
    // Final list of attributes use for provisioning
    return compileAttributes(defaultAttributes, roleSystemAttributesAll, entityType);
}
Also used : EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto)

Example 3 with EntityAccountFilter

use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.

the class AbstractProvisioningExecutor method doProvisioning.

@Override
public void doProvisioning(AccAccountDto account) {
    Assert.notNull(account);
    EntityAccountFilter filter = createEntityAccountFilter();
    filter.setAccountId(account.getId());
    List<? extends EntityAccountDto> entityAccoutnList = getEntityAccountService().find(filter, null).getContent();
    if (entityAccoutnList == null) {
        return;
    }
    entityAccoutnList.stream().filter(entityAccount -> {
        return entityAccount.isOwnership();
    }).forEach((entityAccount) -> {
        doProvisioning(account, getService().get(entityAccount.getEntity()));
    });
}
Also used : ProvisioningExecutor(eu.bcvsolutions.idm.acc.service.api.ProvisioningExecutor) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) EntityAccountDto(eu.bcvsolutions.idm.acc.dto.EntityAccountDto) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) SysSystemEntity_(eu.bcvsolutions.idm.acc.entity.SysSystemEntity_) Map(java.util.Map) ProvisioningEntityExecutor(eu.bcvsolutions.idm.acc.service.api.ProvisioningEntityExecutor) SysSystemAttributeMapping(eu.bcvsolutions.idm.acc.entity.SysSystemAttributeMapping) ImmutableMap(com.google.common.collect.ImmutableMap) Collection(java.util.Collection) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) ReadWriteDtoService(eu.bcvsolutions.idm.core.api.service.ReadWriteDtoService) Set(java.util.Set) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) List(java.util.List) EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter) AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) CollectionUtils(org.springframework.util.CollectionUtils) AccountType(eu.bcvsolutions.idm.acc.domain.AccountType) Optional(java.util.Optional) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) AccAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ProvisioningEvent(eu.bcvsolutions.idm.acc.event.ProvisioningEvent) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) ProvisioningEventType(eu.bcvsolutions.idm.acc.domain.ProvisioningEventType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) IdmAccountDto(eu.bcvsolutions.idm.core.api.dto.IdmAccountDto) HashMap(java.util.HashMap) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) AbstractDto(eu.bcvsolutions.idm.core.api.dto.AbstractDto) ImmutableList(com.google.common.collect.ImmutableList) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) ProvisioningOperationType(eu.bcvsolutions.idm.acc.domain.ProvisioningOperationType) LinkedHashSet(java.util.LinkedHashSet) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) Codeable(eu.bcvsolutions.idm.core.api.domain.Codeable) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysRoleSystemAttributeService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService) SysSchemaObjectClass_(eu.bcvsolutions.idm.acc.entity.SysSchemaObjectClass_) IcConnectorKey(eu.bcvsolutions.idm.ic.api.IcConnectorKey) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) AccAccount_(eu.bcvsolutions.idm.acc.entity.AccAccount_) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) Collections(java.util.Collections) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) PasswordChangeDto(eu.bcvsolutions.idm.core.api.dto.PasswordChangeDto) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) Assert(org.springframework.util.Assert) EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter)

Example 4 with EntityAccountFilter

use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.

the class AbstractProvisioningExecutor method getEntityByAccount.

protected UUID getEntityByAccount(UUID accountId, UUID systemId) {
    EntityAccountFilter entityAccountFilter = createEntityAccountFilter();
    entityAccountFilter.setAccountId(accountId);
    entityAccountFilter.setSystemId(systemId);
    entityAccountFilter.setOwnership(Boolean.TRUE);
    List<? extends EntityAccountDto> entityAccounts = this.getEntityAccountService().find(entityAccountFilter, null).getContent();
    if (entityAccounts.isEmpty()) {
        return null;
    } else {
        // ownership) have same entity!
        return entityAccounts.get(0).getEntity();
    }
}
Also used : EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter)

Example 5 with EntityAccountFilter

use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.

the class ContractSynchronizationExecutor method doUnlink.

/**
 * Operation remove IdentityContractAccount relations and linked roles
 *
 * @param account
 * @param removeIdentityContractIdentityContract
 * @param log
 * @param logItem
 * @param actionLogs
 */
protected void doUnlink(AccAccountDto account, boolean removeIdentityContractIdentityContract, SysSyncLogDto log, SysSyncItemLogDto logItem, List<SysSyncActionLogDto> actionLogs) {
    EntityAccountFilter entityAccountFilter = new AccContractAccountFilter();
    entityAccountFilter.setAccountId(account.getId());
    List<AccContractAccountDto> entityAccounts = contractAccoutnService.find((AccContractAccountFilter) entityAccountFilter, null).getContent();
    if (entityAccounts.isEmpty()) {
        addToItemLog(logItem, "Contract-account relation was not found!");
        initSyncActionLog(SynchronizationActionType.UPDATE_ENTITY, OperationResultType.WARNING, logItem, log, actionLogs);
        return;
    }
    addToItemLog(logItem, MessageFormat.format("Contract-account relations to delete {0}", entityAccounts));
    entityAccounts.stream().forEach(entityAccount -> {
        // We will remove contract account, but without delete connected
        // account
        contractAccoutnService.delete(entityAccount, false);
        addToItemLog(logItem, MessageFormat.format("Contract-account relation deleted (without call delete provisioning) (contract id: {0}, contract-account id: {1})", entityAccount.getContract(), entityAccount.getId()));
    });
    return;
}
Also used : EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter) AccContractAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccContractAccountFilter) AccContractAccountDto(eu.bcvsolutions.idm.acc.dto.AccContractAccountDto)

Aggregations

EntityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter)12 EntityAccountDto (eu.bcvsolutions.idm.acc.dto.EntityAccountDto)4 SysRoleSystemAttributeDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto)4 AttributeMapping (eu.bcvsolutions.idm.acc.domain.AttributeMapping)3 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)3 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)3 SysSystemAttributeMapping (eu.bcvsolutions.idm.acc.entity.SysSystemAttributeMapping)3 UUID (java.util.UUID)3 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 AccResultCode (eu.bcvsolutions.idm.acc.domain.AccResultCode)2 AccountType (eu.bcvsolutions.idm.acc.domain.AccountType)2 AttributeMappingStrategyType (eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType)2 ProvisioningContext (eu.bcvsolutions.idm.acc.domain.ProvisioningContext)2 ProvisioningEventType (eu.bcvsolutions.idm.acc.domain.ProvisioningEventType)2 ProvisioningOperationType (eu.bcvsolutions.idm.acc.domain.ProvisioningOperationType)2 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)2 SystemOperationType (eu.bcvsolutions.idm.acc.domain.SystemOperationType)2 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)2 ProvisioningAttributeDto (eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto)2