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);
}
}
}
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;
}
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;
}
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;
}
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);
});
}
Aggregations