Search in sources :

Example 41 with SystemEntityType

use of eu.bcvsolutions.idm.acc.domain.SystemEntityType in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningArchiveServiceTest method systemEntityUidFilterTest.

@Test
public void systemEntityUidFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    SysSystemDto system = createRoleSystem();
    SysProvisioningArchiveDto provisioningArchive1 = createProvisioningArchive(entityType, system);
    SysProvisioningArchiveDto provisioningArchive2 = createProvisioningArchive(entityType, system);
    SysProvisioningArchiveDto provisioningArchive3 = createProvisioningArchive(entityType, system);
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setSystemEntityUid(provisioningArchive1.getSystemEntityUid());
    Page<SysProvisioningArchiveDto> result = archiveService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(provisioningArchive1));
    assertFalse(result.getContent().contains(provisioningArchive2));
    assertFalse(result.getContent().contains(provisioningArchive3));
}
Also used : SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 42 with SystemEntityType

use of eu.bcvsolutions.idm.acc.domain.SystemEntityType in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemMappingServiceTest method treeTypeIdFilterTest.

@Test
public void treeTypeIdFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    IdmTreeTypeDto treeType = new IdmTreeTypeDto();
    treeType.setName("SomeTreeTypeName");
    treeType.setCode("CodeCodeCodeCode");
    treeType = treeTypeService.save(treeType);
    IdmTreeTypeDto treeType2 = new IdmTreeTypeDto();
    treeType2.setName("SomeTreeTypeName2");
    treeType2.setCode("CodeCodeCodeCode2");
    treeType2 = treeTypeService.save(treeType2);
    SysSystemDto system = createSystem();
    SysSchemaObjectClassDto objectClass = createObjectClass(system);
    SysSystemMappingDto mappingSystem1 = testHelper.createMappingSystem(entityType, objectClass);
    mappingSystem1.setTreeType(treeType.getId());
    mappingSystem1 = mappingService.save(mappingSystem1);
    SysSystemMappingDto mappingSystem2 = testHelper.createMappingSystem(entityType, objectClass);
    mappingSystem2.setTreeType(treeType2.getId());
    mappingSystem2 = mappingService.save(mappingSystem2);
    SysSystemMappingFilter filter = new SysSystemMappingFilter();
    filter.setTreeTypeId(mappingSystem1.getTreeType());
    Page<SysSystemMappingDto> result = mappingService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(mappingSystem1));
    assertFalse(result.getContent().contains(mappingSystem2));
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 43 with SystemEntityType

use of eu.bcvsolutions.idm.acc.domain.SystemEntityType 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 44 with SystemEntityType

use of eu.bcvsolutions.idm.acc.domain.SystemEntityType 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 45 with SystemEntityType

use of eu.bcvsolutions.idm.acc.domain.SystemEntityType in project CzechIdMng by bcvsolutions.

the class DefaultVsRequestService method findTargetEntity.

/**
 * Find target entity for given request.
 * For loading a target entity is using sync executor.
 * If ID of a role request exists, then load applicant from it.
 *
 * @param dto
 * @return
 */
private AbstractDto findTargetEntity(VsRequestDto dto) {
    if (dto.getUid() == null || dto.getSystem() == null) {
        return null;
    }
    // If ID of a role request exists, then load applicant from it.
    UUID roleRequestId = dto.getRoleRequestId();
    if (roleRequestId != null) {
        IdmRoleRequestDto roleRequestDto = roleRequestService.get(roleRequestId);
        if (roleRequestDto != null && roleRequestDto.getApplicant() != null) {
            IdmIdentityDto applicant = DtoUtils.getEmbedded(roleRequestDto, IdmRoleRequest_.applicant, IdmIdentityDto.class, null);
            if (applicant != null) {
                return applicant;
            }
        }
    }
    AccAccountDto account = accAccountService.getAccount(dto.getUid(), dto.getSystem());
    if (account != null) {
        SystemEntityType entityType = account.getEntityType();
        if (entityType != null && entityType.isSupportsSync()) {
            SynchronizationEntityExecutor executor = accAccountService.getSyncExecutor(entityType);
            return executor.getDtoByAccount(null, account);
        }
    }
    return null;
}
Also used : SynchronizationEntityExecutor(eu.bcvsolutions.idm.acc.service.api.SynchronizationEntityExecutor) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) UUID(java.util.UUID) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)

Aggregations

SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)71 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)51 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)36 Test (org.junit.Test)36 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)28 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)28 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)26 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)21 SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)17 UUID (java.util.UUID)17 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)15 SysSyncActionLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto)15 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)15 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)15 SysSyncItemLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto)13 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)11 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)11 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)11 AttributeMappingStrategyType (eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType)10 SysProvisioningArchiveDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto)10