Search in sources :

Example 86 with AccAccountDto

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

the class DefaultSynchronizationService method resolveLinkedSituation.

@Override
public SysSyncItemLogDto resolveLinkedSituation(String uid, SystemEntityType entityType, List<IcAttribute> icAttributes, UUID accountId, UUID configId, String actionType) {
    Assert.notNull(uid);
    Assert.notNull(entityType);
    Assert.notNull(icAttributes);
    Assert.notNull(configId);
    Assert.notNull(actionType);
    Assert.notNull(accountId);
    SysSyncItemLogDto itemLog = new SysSyncItemLogDto();
    AbstractSysSyncConfigDto config = synchronizationConfigService.get(configId);
    SysSystemMappingDto mapping = systemMappingService.get(config.getSystemMapping());
    AccAccountDto account = accountService.get(accountId);
    SysSystemAttributeMappingFilter attributeHandlingFilter = new SysSystemAttributeMappingFilter();
    attributeHandlingFilter.setSystemMappingId(mapping.getId());
    List<SysSystemAttributeMappingDto> mappedAttributes = attributeHandlingService.find(attributeHandlingFilter, null).getContent();
    // Little workaround, we have only IcAttributes ... we create IcObject manually
    IcConnectorObjectImpl icObject = new IcConnectorObjectImpl();
    icObject.setAttributes(icAttributes);
    icObject.setUidValue(uid);
    SynchronizationContext context = new SynchronizationContext();
    context.addUid(uid).addAccount(account).addConfig(config).addEntityType(entityType).addLogItem(itemLog).addMappedAttributes(mappedAttributes).addIcObject(icObject);
    getSyncExecutor(entityType).resolveLinkedSituation(SynchronizationLinkedActionType.valueOf(actionType), context);
    return itemLog;
}
Also used : AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SynchronizationContext(eu.bcvsolutions.idm.acc.domain.SynchronizationContext) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)

Example 87 with AccAccountDto

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

the class DefaultSynchronizationService method resolveMissingAccountSituation.

@Override
public SysSyncItemLogDto resolveMissingAccountSituation(String uid, SystemEntityType entityType, UUID accountId, UUID configId, String actionType) {
    Assert.notNull(uid);
    Assert.notNull(entityType);
    Assert.notNull(configId);
    Assert.notNull(actionType);
    Assert.notNull(accountId);
    AbstractSysSyncConfigDto config = synchronizationConfigService.get(configId);
    SysSystemMappingDto mapping = systemMappingService.get(config.getSystemMapping());
    AccAccountDto account = accountService.get(accountId);
    SysSchemaObjectClassDto sysSchemaObjectClassDto = schemaObjectClassService.get(mapping.getObjectClass());
    SysSystemDto system = DtoUtils.getEmbedded(sysSchemaObjectClassDto, SysSchemaObjectClass_.system, SysSystemDto.class);
    SysSyncItemLogDto itemLog = new SysSyncItemLogDto();
    SynchronizationContext context = new SynchronizationContext();
    context.addUid(uid).addSystem(system).addConfig(config).addEntityType(entityType).addAccount(account).addLogItem(itemLog);
    getSyncExecutor(entityType).resolveMissingAccountSituation(ReconciliationMissingAccountActionType.valueOf(actionType), context);
    return itemLog;
}
Also used : AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SynchronizationContext(eu.bcvsolutions.idm.acc.domain.SynchronizationContext) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 88 with AccAccountDto

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

the class IdentitySynchronizationExecutor method doUpdateEntity.

/**
 * Fill data from IC attributes to entity (EAV and confidential storage too)
 *
 * @param account
 * @param entityType
 * @param uid
 * @param icAttributes
 * @param mappedAttributes
 * @param log
 * @param logItem
 * @param actionLogs
 */
protected void doUpdateEntity(SynchronizationContext context) {
    String uid = context.getUid();
    SysSyncLogDto log = context.getLog();
    SysSyncItemLogDto logItem = context.getLogItem();
    List<SysSyncActionLogDto> actionLogs = context.getActionLogs();
    List<SysSystemAttributeMappingDto> mappedAttributes = context.getMappedAttributes();
    AccAccountDto account = context.getAccount();
    List<IcAttribute> icAttributes = context.getIcObject().getAttributes();
    SystemEntityType entityType = context.getEntityType();
    UUID entityId = getEntityByAccount(account.getId());
    IdmIdentityDto identity = null;
    if (entityId != null) {
        identity = identityService.get(entityId);
    }
    if (identity != null) {
        // Update identity
        identity = fillEntity(mappedAttributes, uid, icAttributes, identity, false, context);
        identity = this.save(identity, true);
        // Update extended attribute (entity must be persisted first)
        updateExtendedAttributes(mappedAttributes, uid, icAttributes, identity, false, context);
        // Update confidential attribute (entity must be persisted
        // first)
        updateConfidentialAttributes(mappedAttributes, uid, icAttributes, identity, false, context);
        // Identity Updated
        addToItemLog(logItem, MessageFormat.format("Identity with id {0} was updated", identity.getId()));
        if (logItem != null) {
            logItem.setDisplayName(identity.getUsername());
        }
        // Call provisioning for entity
        this.callProvisioningForEntity(identity, entityType, logItem);
        return;
    } else {
        addToItemLog(logItem, "Identity account relation (with ownership = true) was not found!");
        initSyncActionLog(SynchronizationActionType.UPDATE_ENTITY, OperationResultType.WARNING, logItem, log, actionLogs);
        return;
    }
}
Also used : SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) SysSyncActionLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) UUID(java.util.UUID) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)

Example 89 with AccAccountDto

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

the class RoleProvisioningExecutor method doProvisioning.

public void doProvisioning(AccAccountDto account) {
    Assert.notNull(account);
    AccRoleAccountFilter filter = new AccRoleAccountFilter();
    filter.setAccountId(account.getId());
    List<AccRoleAccountDto> entityAccoutnList = roleAccountService.find(filter, null).getContent();
    if (entityAccoutnList == null) {
        return;
    }
    entityAccoutnList.stream().filter(entityAccount -> {
        return entityAccount.isOwnership();
    }).forEach((roleAccount) -> {
        doProvisioning(account, DtoUtils.getEmbedded(roleAccount, AccRoleAccount_.role, IdmRoleDto.class));
    });
}
Also used : ProvisioningExecutor(eu.bcvsolutions.idm.acc.service.api.ProvisioningExecutor) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) RoleType(eu.bcvsolutions.idm.core.api.domain.RoleType) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) Autowired(org.springframework.beans.factory.annotation.Autowired) EntityAccountDto(eu.bcvsolutions.idm.acc.dto.EntityAccountDto) AccRoleAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccRoleAccountFilter) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ArrayList(java.util.ArrayList) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) Service(org.springframework.stereotype.Service) Qualifier(org.springframework.beans.factory.annotation.Qualifier) SysRoleSystemAttributeService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService) AccRoleAccountDto(eu.bcvsolutions.idm.acc.dto.AccRoleAccountDto) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) AccRoleAccountService(eu.bcvsolutions.idm.acc.service.api.AccRoleAccountService) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) List(java.util.List) AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) AccRoleAccount_(eu.bcvsolutions.idm.acc.entity.AccRoleAccount_) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) Assert(org.springframework.util.Assert) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) AccRoleAccountDto(eu.bcvsolutions.idm.acc.dto.AccRoleAccountDto) AccRoleAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccRoleAccountFilter)

Example 90 with AccAccountDto

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

the class TreeProvisioningExecutor method doProvisioning.

public void doProvisioning(AccAccountDto account) {
    Assert.notNull(account);
    AccTreeAccountFilter filter = new AccTreeAccountFilter();
    filter.setAccountId(account.getId());
    List<AccTreeAccountDto> treeAccoutnList = treeAccountService.find(filter, null).getContent();
    if (treeAccoutnList == null) {
        return;
    }
    treeAccoutnList.stream().filter(treeAccount -> {
        return treeAccount.isOwnership();
    }).forEach((treeAccount) -> {
        doProvisioning(account, DtoUtils.getEmbedded(treeAccount, AccTreeAccount_.treeNode, IdmTreeNodeDto.class));
    });
}
Also used : ProvisioningExecutor(eu.bcvsolutions.idm.acc.service.api.ProvisioningExecutor) IdmTreeNodeService(eu.bcvsolutions.idm.core.api.service.IdmTreeNodeService) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) AccTreeAccount_(eu.bcvsolutions.idm.acc.entity.AccTreeAccount_) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) EntityAccountDto(eu.bcvsolutions.idm.acc.dto.EntityAccountDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AccTreeAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccTreeAccountFilter) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) ArrayList(java.util.ArrayList) AccAccountManagementService(eu.bcvsolutions.idm.acc.service.api.AccAccountManagementService) AccTreeAccountService(eu.bcvsolutions.idm.acc.service.api.AccTreeAccountService) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) Service(org.springframework.stereotype.Service) Qualifier(org.springframework.beans.factory.annotation.Qualifier) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysRoleSystemAttributeService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService) ImmutableMap(com.google.common.collect.ImmutableMap) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) UUID(java.util.UUID) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) 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) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) AccTreeAccountDto(eu.bcvsolutions.idm.acc.dto.AccTreeAccountDto) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) Assert(org.springframework.util.Assert) AccTreeAccountDto(eu.bcvsolutions.idm.acc.dto.AccTreeAccountDto) AccTreeAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccTreeAccountFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)

Aggregations

AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)90 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)59 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)47 Test (org.junit.Test)45 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)44 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)33 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)29 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)25 AccAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter)19 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)18 TestResource (eu.bcvsolutions.idm.acc.entity.TestResource)18 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)16 AccIdentityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter)16 ArrayList (java.util.ArrayList)16 SysSyncItemLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto)15 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)14 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)14 UUID (java.util.UUID)14 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)13 PasswordChangeDto (eu.bcvsolutions.idm.core.api.dto.PasswordChangeDto)13