Search in sources :

Example 81 with SysSystemMappingFilter

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

the class AdGroupConnectorTypeTest method testOfFullSync.

@Test
public void testOfFullSync() {
    ConnectorType connectorType = connectorManager.getConnectorType(MockAdGroupConnectorType.NAME);
    ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
    SysSystemDto systemDto = createSystem(this.getHelper().createName(), connectorTypeDto);
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
    // Create system with members.
    SysSystemDto memberSystemDto = createMemberSystem();
    SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
    mappingFilter.setSystemId(memberSystemDto.getId());
    mappingFilter.setOperationType(SystemOperationType.PROVISIONING);
    mappingFilter.setEntityType(SystemEntityType.IDENTITY);
    SysSystemMappingDto mappingDto = mappingService.find(mappingFilter, null).getContent().stream().findFirst().orElse(null);
    assertNotNull(mappingDto);
    StringBuilder sb = new StringBuilder();
    sb.append(this.getHelper().createName());
    sb.append(AdGroupConnectorType.LINE_SEPARATOR);
    sb.append(this.getHelper().createName());
    String groupContainersMock = sb.toString();
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.GROUP_CONTAINER_KEY, groupContainersMock);
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.MEMBER_SYSTEM_MAPPING, mappingDto.getId().toString());
    connectorTypeDto.setWizardStepName(MockAdGroupConnectorType.STEP_FOUR);
    // Generate mock schema.
    generateMockSchema(systemDto);
    IdmRoleCatalogueDto mainCatalog = getHelper().createRoleCatalogue(getHelper().createName());
    // Enable wizard switches.
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.membershipSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignCatalogueSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignRoleSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignRoleRemoveSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.removeCatalogueRoleSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.MAIN_ROLE_CATALOG, mainCatalog.getId().toString());
    // Execute step four.
    connectorManager.execute(connectorTypeDto);
    SysSyncConfigFilter syncConfigFilter = new SysSyncConfigFilter();
    syncConfigFilter.setSystemId(systemDto.getId());
    AbstractSysSyncConfigDto syncConfigDto = syncConfigService.find(syncConfigFilter, null).getContent().stream().findFirst().orElse(null);
    assertTrue(syncConfigDto instanceof SysSyncRoleConfigDto);
    SysSyncRoleConfigDto syncRoleConfigDto = (SysSyncRoleConfigDto) syncConfigDto;
    assertTrue(syncRoleConfigDto.isMembershipSwitch());
    assertTrue(syncRoleConfigDto.isRemoveCatalogueRoleSwitch());
    assertTrue(syncRoleConfigDto.isAssignRoleRemoveSwitch());
    assertTrue(syncRoleConfigDto.isAssignRoleSwitch());
    assertTrue(syncRoleConfigDto.isAssignCatalogueSwitch());
    assertNotNull(syncRoleConfigDto.getAssignCatalogueMappingAttribute());
    assertNotNull(syncRoleConfigDto.getSkipValueIfExcludedMappingAttribute());
    assertNotNull(syncRoleConfigDto.getForwardAcmMappingAttribute());
    assertNotNull(syncRoleConfigDto.getRoleMembersMappingAttribute());
    assertNotNull(syncRoleConfigDto.getRoleIdentifiersMappingAttribute());
    assertNotNull(syncRoleConfigDto.getMemberIdentifierAttribute());
    assertNotNull(syncRoleConfigDto.getMemberOfAttribute());
    // Clean
    systemService.delete(systemDto);
    systemService.delete(memberSystemDto);
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) AdGroupConnectorType(eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) MockAdGroupConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdGroupConnectorType) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 82 with SysSystemMappingFilter

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

the class SynchronizationSchedulableTaskExecutorIntegrationTest method testFormInstance.

@Test
public void testFormInstance() {
    ConfigurationMap properties = new ConfigurationMap();
    // 
    Assert.assertNull(executor.getFormInstance(properties));
    // 
    UUID synchronizationId = UUID.randomUUID();
    properties.put(SynchronizationService.PARAMETER_SYNCHRONIZATION_ID, synchronizationId);
    // 
    IdmFormInstanceDto formInstance = executor.getFormInstance(properties);
    Assert.assertNotNull(formInstance);
    Assert.assertNotNull(formInstance.getValues().stream().anyMatch(v -> v.getUuidValue().equals(synchronizationId) && v.getEmbedded().get(IdmFormValueDto.PROPERTY_UUID_VALUE) != null));
    // 
    SysSystemDto system = getHelper().createTestResourceSystem(true);
    SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
    mappingFilter.setSystemId(system.getId());
    List<SysSystemMappingDto> mappings = systemMappingService.find(mappingFilter, null).getContent();
    SysSystemMappingDto mapping = mappings.get(0);
    SysSystemAttributeMappingFilter attributeMappingFilter = new SysSystemAttributeMappingFilter();
    attributeMappingFilter.setSystemMappingId(mapping.getId());
    List<SysSystemAttributeMappingDto> attributes = schemaAttributeMappingService.find(attributeMappingFilter, null).getContent();
    SysSystemAttributeMappingDto nameAttribute = attributes.stream().filter(attribute -> {
        return attribute.getName().equals(TestHelper.ATTRIBUTE_MAPPING_NAME);
    }).findFirst().get();
    // Create default synchronization config.
    AbstractSysSyncConfigDto syncConfigCustom = new SysSyncIdentityConfigDto();
    syncConfigCustom.setCustomFilter(true);
    syncConfigCustom.setSystemMapping(mapping.getId());
    syncConfigCustom.setCorrelationAttribute(nameAttribute.getId());
    syncConfigCustom.setName(getHelper().createName());
    AbstractSysSyncConfigDto syncConfig = syncConfigService.save(syncConfigCustom);
    properties.put(SynchronizationService.PARAMETER_SYNCHRONIZATION_ID, syncConfig.getId());
    // 
    formInstance = executor.getFormInstance(properties);
    Assert.assertNotNull(formInstance);
    Assert.assertNotNull(formInstance.getValues().stream().anyMatch(v -> v.getUuidValue().equals(syncConfig.getId()) && v.getEmbedded().get(IdmFormValueDto.PROPERTY_UUID_VALUE) != null));
}
Also used : IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) Autowired(org.springframework.beans.factory.annotation.Autowired) Test(org.junit.Test) UUID(java.util.UUID) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) List(java.util.List) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) SynchronizationService(eu.bcvsolutions.idm.acc.service.api.SynchronizationService) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) SysSyncConfigService(eu.bcvsolutions.idm.acc.service.api.SysSyncConfigService) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) Assert(org.junit.Assert) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap) UUID(java.util.UUID) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 83 with SysSystemMappingFilter

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

the class SystemMappingSaveProcessor method getMapping.

private List<SysSystemMappingDto> getMapping(SystemEntityType entityType, UUID systemId, UUID treeTypeId) {
    SysSystemMappingFilter filter = new SysSystemMappingFilter();
    filter.setEntityType(entityType);
    filter.setTreeTypeId(treeTypeId);
    filter.setOperationType(SystemOperationType.PROVISIONING);
    filter.setSystemId(systemId);
    return systemMappingService.find(filter, null).getContent();
}
Also used : SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)

Example 84 with SysSystemMappingFilter

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

the class DefaultSysRoleSystemAttributeService method getSystemMapping.

@Transactional
@Override
public SysSystemMappingDto getSystemMapping(UUID systemId, String objectClassName, SystemOperationType operationType) {
    Assert.notNull(systemId, "SystemId cannot be null!");
    Assert.notNull(objectClassName, "ObjectClassName cannot be null!");
    Assert.notNull(operationType, "OperationType cannot be null!");
    SysSystemMappingFilter filter = new SysSystemMappingFilter();
    filter.setSystemId(systemId);
    filter.setOperationType(operationType);
    filter.setObjectClassId(getObjectClassId(systemId, objectClassName));
    List<SysSystemMappingDto> systemMappings = systemMappingService.find(filter, null).getContent();
    if (systemMappings.isEmpty()) {
        throw new ResultCodeException(AccResultCode.SYSTEM_MAPPING_NOT_FOUND, ImmutableMap.of("systemId", systemId, "objectClassName", objectClassName));
    }
    return systemMappings.get(0);
}
Also used : SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) Transactional(org.springframework.transaction.annotation.Transactional)

Example 85 with SysSystemMappingFilter

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

the class DefaultRoleSynchronizationExecutorTest method createUserSyncConfig.

public SysSyncIdentityConfigDto createUserSyncConfig(SysSystemDto system) {
    SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
    mappingFilter.setEntityType(SystemEntityType.IDENTITY);
    mappingFilter.setSystemId(system.getId());
    mappingFilter.setOperationType(SystemOperationType.SYNCHRONIZATION);
    List<SysSystemMappingDto> mappings = systemMappingService.find(mappingFilter, null).getContent();
    Assert.assertEquals(1, mappings.size());
    SysSystemMappingDto mapping = mappings.get(0);
    SysSystemAttributeMappingFilter attributeMappingFilter = new SysSystemAttributeMappingFilter();
    attributeMappingFilter.setSystemMappingId(mapping.getId());
    List<SysSystemAttributeMappingDto> attributes = schemaAttributeMappingService.find(attributeMappingFilter, null).getContent();
    SysSystemAttributeMappingDto uidAttribute = attributes.stream().filter(attribute -> {
        return attribute.isUid();
    }).findFirst().orElse(null);
    // Create default synchronization config
    SysSyncIdentityConfigDto syncConfigCustom = new SysSyncIdentityConfigDto();
    syncConfigCustom.setReconciliation(true);
    syncConfigCustom.setCustomFilter(false);
    syncConfigCustom.setSystemMapping(mapping.getId());
    syncConfigCustom.setCorrelationAttribute(uidAttribute.getId());
    syncConfigCustom.setName(getHelper().createName());
    syncConfigCustom.setLinkedAction(SynchronizationLinkedActionType.UPDATE_ENTITY);
    syncConfigCustom.setUnlinkedAction(SynchronizationUnlinkedActionType.IGNORE);
    syncConfigCustom.setMissingEntityAction(SynchronizationMissingEntityActionType.CREATE_ENTITY);
    syncConfigCustom.setMissingAccountAction(ReconciliationMissingAccountActionType.IGNORE);
    syncConfigCustom.setCreateDefaultContract(true);
    return (SysSyncIdentityConfigDto) syncConfigService.save(syncConfigCustom);
}
Also used : SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)

Aggregations

SysSystemMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)91 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)84 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)67 Test (org.junit.Test)62 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)55 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)51 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)49 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)25 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)23 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)20 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)14 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)11 ConnectorType (eu.bcvsolutions.idm.acc.service.api.ConnectorType)11 ConnectorTypeDto (eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto)10 SysSyncIdentityConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto)10 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)8 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)8 Transactional (org.springframework.transaction.annotation.Transactional)8 SysSyncRoleConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto)7 SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)7