Search in sources :

Example 21 with SystemEntityType

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

the class AbstractProvisioningExecutor method accountManagement.

@Override
public boolean accountManagement(DTO dto) {
    SystemEntityType entityType = SystemEntityType.getByClass(dto.getClass());
    List<SysSystemMappingDto> systemMappings = findSystemMappingsForEntityType(dto, entityType);
    systemMappings.forEach(mapping -> {
        SysSchemaObjectClassDto schemaObjectClassDto = schemaObjectClassService.get(mapping.getObjectClass());
        UUID systemId = schemaObjectClassDto.getSystem();
        UUID accountId = this.getAccountByEntity(dto.getId(), systemId);
        if (accountId != null) {
            // We already have account for this system -> next
            return;
        }
        SysSystemDto system = DtoUtils.getEmbedded(schemaObjectClassDto, SysSchemaObjectClass_.system);
        List<SysSystemAttributeMappingDto> mappedAttributes = attributeMappingService.findBySystemMapping(mapping);
        SysSystemAttributeMappingDto uidAttribute = attributeMappingService.getUidAttribute(mappedAttributes, system);
        String uid = attributeMappingService.generateUid(dto, uidAttribute);
        // Account management - can be the account created? - execute the script on the system mapping
        if (!this.canBeAccountCreated(uid, dto, mapping, system)) {
            String entityStr = dto.toString();
            if (dto instanceof Codeable) {
                entityStr = ((Codeable) dto).getCode();
            }
            LOG.info(MessageFormat.format("For entity [{0}] and entity type [{1}] cannot be created the account (on system [{2}])," + " because script \"Can be account created\" on the mapping returned \"false\"!", entityStr, entityType, system.getName()));
            return;
        }
        // Create AccAccount and relation between account and entity
        createEntityAccount(uid, dto.getId(), systemId);
    });
    return true;
}
Also used : Codeable(eu.bcvsolutions.idm.core.api.domain.Codeable) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) UUID(java.util.UUID) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 22 with SystemEntityType

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

the class DefaultSysSystemAttributeMappingServiceTest method textFilterTest.

@Test
public void textFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    AttributeMappingStrategyType strategyType = AttributeMappingStrategyType.MERGE;
    SysSystemDto system = createSystem();
    SysSchemaObjectClassDto objectClass = createObjectClass(system);
    SysSystemMappingDto systemMapping = testHelper.createMappingSystem(entityType, objectClass);
    SysSchemaAttributeDto schemaAttribute = createSchemaAttribute(objectClass);
    SysSystemAttributeMappingDto attributeMapping1 = createAttributeMappingSystem(systemMapping, strategyType, schemaAttribute.getId());
    attributeMapping1.setName("OriginalName01");
    attributeMappingService.save(attributeMapping1);
    SysSystemAttributeMappingDto attributeMapping2 = createAttributeMappingSystem(systemMapping, AttributeMappingStrategyType.CREATE, schemaAttribute.getId());
    attributeMapping2.setName("OriginalName21");
    attributeMappingService.save(attributeMapping2);
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setText("OriginalName0");
    Page<SysSystemAttributeMappingDto> result = attributeMappingService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(attributeMapping1));
    assertFalse(result.getContent().contains(attributeMapping2));
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) 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) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 23 with SystemEntityType

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

the class DefaultSysSystemAttributeMappingServiceTest method isUidFitlerTest.

@Test
public void isUidFitlerTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    AttributeMappingStrategyType strategyType = AttributeMappingStrategyType.MERGE;
    SysSystemDto system = createSystem();
    SysSchemaObjectClassDto objectClass = createObjectClass(system);
    SysSystemMappingDto systemMapping1 = testHelper.createMappingSystem(entityType, objectClass);
    SysSystemMappingDto systemMapping2 = testHelper.createMappingSystem(entityType, objectClass);
    SysSchemaAttributeDto schemaAttribute = createSchemaAttribute(objectClass);
    SysSystemAttributeMappingDto attributeMapping1 = createAttributeMappingSystem(systemMapping1, AttributeMappingStrategyType.CREATE, schemaAttribute.getId());
    SysSystemAttributeMappingDto attributeMapping2 = createAttributeMappingSystem(systemMapping2, strategyType, schemaAttribute.getId());
    attributeMapping2.setUid(true);
    attributeMappingService.save(attributeMapping2);
    createAttributeMappingSystem(systemMapping1, AttributeMappingStrategyType.SET, schemaAttribute.getId());
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setIsUid(true);
    filter.setSystemId(system.getId());
    Page<SysSystemAttributeMappingDto> result = attributeMappingService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(attributeMapping2));
    assertFalse(result.getContent().contains(attributeMapping1));
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) 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) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 24 with SystemEntityType

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

the class DefaultSysSystemAttributeMappingServiceTest method schemaAttributeIdFilterTest.

@Test
public void schemaAttributeIdFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    AttributeMappingStrategyType strategyType = AttributeMappingStrategyType.MERGE;
    SysSystemDto system = createSystem();
    SysSchemaObjectClassDto objectClass = createObjectClass(system);
    SysSystemMappingDto systemMapping = testHelper.createMappingSystem(entityType, objectClass);
    SysSchemaAttributeDto schemaAttribute = createSchemaAttribute(objectClass);
    SysSchemaAttributeDto schemaAttribute2 = createSchemaAttribute(objectClass);
    SysSystemAttributeMappingDto attributeMapping = createAttributeMappingSystem(systemMapping, strategyType, schemaAttribute.getId());
    SysSystemAttributeMappingDto attributeMapping2 = createAttributeMappingSystem(systemMapping, strategyType, schemaAttribute2.getId());
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setSchemaAttributeId(schemaAttribute.getId());
    Page<SysSystemAttributeMappingDto> result = attributeMappingService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(attributeMapping));
    assertFalse(result.getContent().contains(attributeMapping2));
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) 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) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 25 with SystemEntityType

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

the class DefaultSysSystemAttributeMappingServiceTest method systemIdFilterTest.

@Test
public void systemIdFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    AttributeMappingStrategyType strategyType = AttributeMappingStrategyType.MERGE;
    SysSystemDto system1 = createSystem();
    SysSystemDto system2 = createSystem();
    SysSchemaObjectClassDto objectClass1 = createObjectClass(system1);
    SysSchemaObjectClassDto objectClass2 = createObjectClass(system2);
    SysSystemMappingDto systemMapping1 = testHelper.createMappingSystem(entityType, objectClass1);
    SysSystemMappingDto systemMapping2 = testHelper.createMappingSystem(entityType, objectClass2);
    SysSchemaAttributeDto schemaAttribute1 = createSchemaAttribute(objectClass1);
    SysSchemaAttributeDto schemaAttribute2 = createSchemaAttribute(objectClass2);
    SysSystemAttributeMappingDto attributeMapping1 = createAttributeMappingSystem(systemMapping1, strategyType, schemaAttribute1.getId());
    SysSystemAttributeMappingDto attributeMapping2 = createAttributeMappingSystem(systemMapping2, strategyType, schemaAttribute2.getId());
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setSystemId(system1.getId());
    Page<SysSystemAttributeMappingDto> result = attributeMappingService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(attributeMapping1));
    assertFalse(result.getContent().contains(attributeMapping2));
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) 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) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

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