Search in sources :

Example 61 with SysSchemaObjectClassDto

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

the class RoleSynchronizationExecutor method checkMembershipChange.

/**
 * Check if role membership value is different.
 */
private void checkMembershipChange(IdmRoleDto dto, SynchronizationContext context, String attributeProperty, Object transformedValue) {
    if (!context.isEntityDifferent() && dto.getId() != null && getConfig(context).isMembershipSwitch()) {
        // Check if forward ACM value should be modified (differential sync).
        SysSystemAttributeMappingDto memberOfAttributeDto = lookupService.lookupEmbeddedDto(getConfig(context), SysSyncRoleConfig_.memberOfAttribute);
        Assert.notNull(memberOfAttributeDto, "Member attribute cannot be null!");
        SysSchemaAttributeDto schemaAttributeDto = lookupService.lookupEmbeddedDto(memberOfAttributeDto, SysSystemAttributeMapping_.schemaAttribute);
        SysSchemaObjectClassDto schemaObjectClassDto = lookupService.lookupEmbeddedDto(schemaAttributeDto, SysSchemaAttribute_.objectClass);
        Assert.notNull(schemaObjectClassDto, "Schema cannot be null!");
        String roleIdentifier = null;
        if (transformedValue != null) {
            Assert.isInstanceOf(String.class, transformedValue, "Role identifier must be String!");
            roleIdentifier = (String) transformedValue;
        } else {
            // Identifier form transformation is null -> We will delete role-system relations.
            setDifferentChange(context, attributeProperty);
            return;
        }
        SysRoleSystemDto roleSystemDto = findRoleSystemDto(dto, memberOfAttributeDto, schemaObjectClassDto);
        if (roleSystemDto != null) {
            SysRoleSystemAttributeDto roleMemberOfAttributeDto = findMemberAttribute(memberOfAttributeDto, schemaObjectClassDto, roleSystemDto);
            if (roleMemberOfAttributeDto == null) {
                // Role attribute by mapping system attribute will be created.
                setDifferentChange(context, attributeProperty);
                return;
            }
            String membershipTransformationScript = getMembershipTransformationScript(roleIdentifier);
            if (!roleMemberOfAttributeDto.getTransformScript().equals(membershipTransformationScript)) {
                // Transformation script is different and will be updated.
                setDifferentChange(context, attributeProperty);
            }
        } else {
            // Role system will be created.
            setDifferentChange(context, attributeProperty);
        }
    }
}
Also used : SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto)

Example 62 with SysSchemaObjectClassDto

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

the class GenerateSchemaWithEavTest method initData.

private SysSystemDto initData() {
    // create test system
    SysSystemDto system = helper.createSystem(TestSchemaResource.TABLE_NAME, null, null, "NAME");
    Assert.assertNotNull(system);
    // generate schema for system
    List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
    // Create synchronization mapping
    SysSystemMappingDto syncSystemMapping = new SysSystemMappingDto();
    syncSystemMapping.setName("default_generate_schema_" + System.currentTimeMillis());
    syncSystemMapping.setEntityType(SystemEntityType.IDENTITY);
    syncSystemMapping.setOperationType(SystemOperationType.SYNCHRONIZATION);
    syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
    final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
    createMapping(system, syncMapping);
    return system;
}
Also used : SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 63 with SysSchemaObjectClassDto

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

the class RoleWorkflowAdSyncTest method initData.

private SysSystemDto initData(String systemName, boolean isProvisioning) {
    // create test system
    SysSystemDto system = helper.createSystem(TestRoleResource.TABLE_NAME, systemName);
    Assert.assertNotNull(system);
    // generate schema for system
    List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
    // Create synchronization mapping
    SysSystemMappingDto syncSystemMapping = new SysSystemMappingDto();
    syncSystemMapping.setName("default_" + System.currentTimeMillis());
    syncSystemMapping.setEntityType(SystemEntityType.ROLE);
    syncSystemMapping.setOperationType(SystemOperationType.SYNCHRONIZATION);
    syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
    if (isProvisioning) {
        syncSystemMapping.setEntityType(SystemEntityType.IDENTITY);
        syncSystemMapping.setOperationType(SystemOperationType.PROVISIONING);
    }
    final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
    createMapping(system, syncMapping);
    if (!isProvisioning) {
        this.getBean().initIdentityData(ROLE_NAME, ATTRIBUTE_DN_VALUE);
    }
    return system;
}
Also used : SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 64 with SysSchemaObjectClassDto

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

the class IdentitySyncTest method initData.

private SysSystemDto initData(String username, String email) {
    // create test system
    SysSystemDto system = helper.createSystem(TestResource.TABLE_NAME);
    Assert.assertNotNull(system);
    // generate schema for system
    List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
    // Create synchronization mapping
    SysSystemMappingDto syncSystemMapping = new SysSystemMappingDto();
    syncSystemMapping.setName(getHelper().createName());
    syncSystemMapping.setEntityType(SystemEntityType.IDENTITY);
    syncSystemMapping.setOperationType(SystemOperationType.SYNCHRONIZATION);
    syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
    final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
    createMapping(system, syncMapping);
    this.getBean().initIdentityData(username, email);
    return system;
}
Also used : SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 65 with SysSchemaObjectClassDto

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

the class TreeSyncTest method initData.

private void initData(String treeTypeCode) {
    // create test system
    system = helper.createSystem("test_tree_resource");
    system.setName(helper.createName());
    system = systemService.save(system);
    // key to EAV
    IdmFormDefinitionDto formDefinition = systemService.getConnectorFormDefinition(system);
    formService.saveValues(system, formDefinition, "keyColumn", ImmutableList.of("ID"));
    // generate schema for system
    List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
    IdmTreeTypeDto treeType = treeTypeService.getByCode(treeTypeCode);
    if (treeType == null) {
        treeType = new IdmTreeTypeDto();
        treeType.setCode(treeTypeCode);
        treeType.setName(treeTypeCode);
        treeType = treeTypeService.save(treeType);
    }
    // Create synchronization mapping
    SysSystemMappingDto syncSystemMapping = new SysSystemMappingDto();
    syncSystemMapping.setName("default_" + System.currentTimeMillis());
    syncSystemMapping.setEntityType(SystemEntityType.TREE);
    syncSystemMapping.setTreeType(treeType.getId());
    syncSystemMapping.setOperationType(SystemOperationType.SYNCHRONIZATION);
    syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
    final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
    createMapping(system, syncMapping);
    initTreeData();
    syncConfigService.find(null).getContent().forEach(config -> {
        syncConfigService.delete(config);
    });
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)

Aggregations

SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)156 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)125 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)114 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)65 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)63 Test (org.junit.Test)59 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)44 SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)38 UUID (java.util.UUID)32 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)29 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)28 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)25 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)21 SysSystemMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)21 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)21 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)20 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)19 IdmFormDefinitionDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto)19 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)18 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)17