use of eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto in project CzechIdMng by bcvsolutions.
the class AccountManagementTest method initData.
private SysSystemDto initData() {
// create test system
SysSystemDto system = helper.createSystem(TestRoleResource.TABLE_NAME);
Assert.assertNotNull(system);
// generate schema for system
List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
// Create mapping
SysSystemMappingDto syncSystemMapping = new SysSystemMappingDto();
syncSystemMapping.setName("default_" + System.currentTimeMillis());
syncSystemMapping.setEntityType(SystemEntityType.ROLE);
syncSystemMapping.setOperationType(SystemOperationType.PROVISIONING);
syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
createMapping(system, syncMapping);
this.getBean().initRoleData();
return system;
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto in project CzechIdMng by bcvsolutions.
the class IdentityRoleValidRequestSchedulerTest method createAndSaveSystemWithMapping.
private SysSystemDto createAndSaveSystemWithMapping() {
system = null;
systemMapping = null;
SysSystemAttributeMappingDto nameAttributeMapping = null;
SysSystemAttributeMappingDto firstNameAttributeMapping = null;
SysSystemAttributeMappingDto lastNameAttributeMapping = null;
SysSystemAttributeMappingDto passwordAttributeMapping = null;
// prepare test system
system = helper.createSystem(TestResource.TABLE_NAME);
// generate schema
List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
// create test mapping
systemMapping = new SysSystemMappingDto();
systemMapping.setName("default_" + System.currentTimeMillis());
systemMapping.setEntityType(SystemEntityType.IDENTITY);
systemMapping.setOperationType(SystemOperationType.PROVISIONING);
systemMapping.setObjectClass(objectClasses.get(0).getId());
systemMapping = mappingService.save(systemMapping);
SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
schemaAttributeFilter.setSystemId(system.getId());
Page<SysSchemaAttributeDto> schemaAttributesPage = schemaAttributeService.find(schemaAttributeFilter, null);
for (SysSchemaAttributeDto schemaAttr : schemaAttributesPage) {
if ("__NAME__".equals(schemaAttr.getName())) {
nameAttributeMapping = new SysSystemAttributeMappingDto();
nameAttributeMapping.setUid(true);
nameAttributeMapping.setEntityAttribute(true);
nameAttributeMapping.setIdmPropertyName("username");
nameAttributeMapping.setName(schemaAttr.getName());
nameAttributeMapping.setSchemaAttribute(schemaAttr.getId());
nameAttributeMapping.setSystemMapping(systemMapping.getId());
nameAttributeMapping = attributeMappingService.save(nameAttributeMapping);
} else if ("firstname".equalsIgnoreCase(schemaAttr.getName())) {
firstNameAttributeMapping = new SysSystemAttributeMappingDto();
firstNameAttributeMapping.setIdmPropertyName("firstName");
firstNameAttributeMapping.setSchemaAttribute(schemaAttr.getId());
firstNameAttributeMapping.setName(schemaAttr.getName());
firstNameAttributeMapping.setSystemMapping(systemMapping.getId());
firstNameAttributeMapping = attributeMappingService.save(firstNameAttributeMapping);
} else if ("lastname".equalsIgnoreCase(schemaAttr.getName())) {
lastNameAttributeMapping = new SysSystemAttributeMappingDto();
lastNameAttributeMapping.setIdmPropertyName("lastName");
lastNameAttributeMapping.setName(schemaAttr.getName());
lastNameAttributeMapping.setSchemaAttribute(schemaAttr.getId());
lastNameAttributeMapping.setSystemMapping(systemMapping.getId());
lastNameAttributeMapping = attributeMappingService.save(lastNameAttributeMapping);
} else if (IcConnectorFacade.PASSWORD_ATTRIBUTE_NAME.equalsIgnoreCase(schemaAttr.getName())) {
passwordAttributeMapping = new SysSystemAttributeMappingDto();
passwordAttributeMapping.setIdmPropertyName("password");
passwordAttributeMapping.setSchemaAttribute(schemaAttr.getId());
passwordAttributeMapping.setName(schemaAttr.getName());
passwordAttributeMapping.setSystemMapping(systemMapping.getId());
passwordAttributeMapping = attributeMappingService.save(passwordAttributeMapping);
}
}
assertNotNull(system);
assertNotNull(nameAttributeMapping);
assertNotNull(firstNameAttributeMapping);
assertNotNull(lastNameAttributeMapping);
assertNotNull(passwordAttributeMapping);
return system;
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto in project CzechIdMng by bcvsolutions.
the class DefaultRoleCatalogueProvisioningTest method initData.
private void initData() {
// create test system
system = helper.createSystem("test_tree_resource");
system.setName(SYSTEM_NAME);
system = systemService.save(system);
// key to EAV
IdmFormDefinitionDto savedFormDefinition = systemService.getConnectorFormDefinition(system.getConnectorInstance());
IdmFormAttributeDto attributeKeyColumn = savedFormDefinition.getMappedAttributeByCode("keyColumn");
formService.saveValues(system, attributeKeyColumn, ImmutableList.of("ID"));
// 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_CATALOGUE);
syncSystemMapping.setOperationType(SystemOperationType.PROVISIONING);
syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
createMapping(system, syncMapping);
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto in project CzechIdMng by bcvsolutions.
the class DefaultRoleSynchronizationServiceTest method initData.
private void initData() {
// create test system
system = helper.createSystem("test_role_resource");
system.setName(SYSTEM_NAME);
system = systemService.save(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());
final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
createMapping(system, syncMapping);
initRoleData();
syncConfigService.find(null).getContent().forEach(config -> {
syncConfigService.delete(config);
});
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto in project CzechIdMng by bcvsolutions.
the class DefaultSysProvisioningServiceTest method initData.
private void initData() {
IdmIdentityDto identity;
AccAccountDto accountOne;
AccIdentityAccountDto accountIdentityOne;
// create test system
SysSystemDto system = helper.createSystem(TestResource.TABLE_NAME, SYSTEM_NAME);
// set default generate password policy for system
IdmPasswordPolicyDto passwordPolicy = new IdmPasswordPolicyDto();
passwordPolicy.setName(PASSWORD_POLICY);
passwordPolicy.setType(IdmPasswordPolicyType.GENERATE);
passwordPolicy.setGenerateType(IdmPasswordPolicyGenerateType.RANDOM);
passwordPolicy.setLowerCharBase("a");
passwordPolicy.setMinPasswordLength(2);
passwordPolicy.setMaxPasswordLength(2);
passwordPolicy.setMinLowerChar(2);
passwordPolicy = passwordPolicyService.save(passwordPolicy);
system.setPasswordPolicyGenerate(passwordPolicy.getId());
system = systemService.save(system);
// generate schema for system
List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
// Create test identity for provisioning test
identity = new IdmIdentityDto();
identity.setUsername(IDENTITY_USERNAME);
identity.setFirstName(IDENTITY_USERNAME);
identity.setLastName(IDENTITY_USERNAME);
identity = idmIdentityService.save(identity);
accountOne = new AccAccountDto();
accountOne.setSystem(system.getId());
accountOne.setUid("x" + IDENTITY_USERNAME);
accountOne.setAccountType(AccountType.PERSONAL);
accountOne.setEntityType(SystemEntityType.IDENTITY);
accountOne = accountService.save(accountOne);
accountIdentityOne = new AccIdentityAccountDto();
accountIdentityOne.setIdentity(identity.getId());
accountIdentityOne.setOwnership(true);
accountIdentityOne.setAccount(accountOne.getId());
accountIdentityOne = identityAccoutnService.save(accountIdentityOne);
IdmIdentityDto identityTwo = new IdmIdentityDto();
identityTwo.setUsername(IDENTITY_USERNAME_TWO);
identityTwo.setFirstName(IDENTITY_USERNAME_TWO);
identityTwo.setLastName(IDENTITY_USERNAME_TWO);
identityTwo = idmIdentityService.save(identityTwo);
AccAccountDto accountTwo = new AccAccountDto();
accountTwo.setSystem(system.getId());
accountTwo.setUid("x" + IDENTITY_USERNAME_TWO);
accountTwo.setAccountType(AccountType.PERSONAL);
accountTwo.setEntityType(SystemEntityType.IDENTITY);
accountTwo = accountService.save(accountTwo);
AccIdentityAccountDto accountIdentityTwo = new AccIdentityAccountDto();
accountIdentityTwo.setIdentity(identityTwo.getId());
accountIdentityTwo.setOwnership(true);
accountIdentityTwo.setAccount(accountTwo.getId());
accountIdentityTwo = identityAccoutnService.save(accountIdentityTwo);
SysSystemMappingDto systemMapping = new SysSystemMappingDto();
systemMapping.setName("default_" + System.currentTimeMillis());
systemMapping.setEntityType(SystemEntityType.IDENTITY);
systemMapping.setOperationType(SystemOperationType.PROVISIONING);
systemMapping.setObjectClass(objectClasses.get(0).getId());
final SysSystemMappingDto entityHandlingResult = systemEntityHandlingService.save(systemMapping);
SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
schemaAttributeFilter.setSystemId(system.getId());
Page<SysSchemaAttributeDto> schemaAttributesPage = schemaAttributeService.find(schemaAttributeFilter, null);
schemaAttributesPage.forEach(schemaAttr -> {
if ("__NAME__".equals(schemaAttr.getName())) {
SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
attributeMapping.setUid(true);
attributeMapping.setEntityAttribute(true);
attributeMapping.setIdmPropertyName(IdmIdentity_.username.getName());
attributeMapping.setTransformToResourceScript("if(attributeValue){return \"x\"+ attributeValue;}");
attributeMapping.setName(schemaAttr.getName());
attributeMapping.setSchemaAttribute(schemaAttr.getId());
attributeMapping.setSystemMapping(entityHandlingResult.getId());
attributeMapping = systemAttributeMappingService.save(attributeMapping);
} else if ("firstname".equalsIgnoreCase(schemaAttr.getName())) {
SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
attributeMapping.setIdmPropertyName(IdmIdentity_.firstName.getName());
attributeMapping.setSchemaAttribute(schemaAttr.getId());
attributeMapping.setName(schemaAttr.getName());
attributeMapping.setTransformFromResourceScript("if(attributeValue){return attributeValue.substring(1);}");
attributeMapping.setSystemMapping(entityHandlingResult.getId());
attributeMapping = systemAttributeMappingService.save(attributeMapping);
} else if ("lastname".equalsIgnoreCase(schemaAttr.getName())) {
SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
attributeMapping.setIdmPropertyName(IdmIdentity_.lastName.getName());
attributeMapping.setName(schemaAttr.getName());
attributeMapping.setSchemaAttribute(schemaAttr.getId());
attributeMapping.setSystemMapping(entityHandlingResult.getId());
attributeMapping = systemAttributeMappingService.save(attributeMapping);
} else if (IcConnectorFacade.PASSWORD_ATTRIBUTE_NAME.equalsIgnoreCase(schemaAttr.getName())) {
SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
attributeMapping.setIdmPropertyName("password");
attributeMapping.setSchemaAttribute(schemaAttr.getId());
attributeMapping.setName(schemaAttr.getName());
attributeMapping.setSystemMapping(entityHandlingResult.getId());
attributeMapping = systemAttributeMappingService.save(attributeMapping);
} else if ("email".equalsIgnoreCase(schemaAttr.getName())) {
SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
attributeMapping.setIdmPropertyName(IdmIdentity_.email.getName());
attributeMapping.setName(schemaAttr.getName());
attributeMapping.setSchemaAttribute(schemaAttr.getId());
attributeMapping.setStrategyType(AttributeMappingStrategyType.CREATE);
attributeMapping.setSystemMapping(entityHandlingResult.getId());
attributeMapping.setTransformToResourceScript("return \"" + EMAIL_ONE + "\";");
attributeMapping = systemAttributeMappingService.save(attributeMapping);
}
});
}
Aggregations