Search in sources :

Example 96 with SysSchemaObjectClassDto

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

the class MsSqlConnectorType method executeStepOne.

@Override
protected void executeStepOne(ConnectorTypeDto connectorType) {
    String port = connectorType.getMetadata().get(PORT);
    Assert.notNull(port, "Port cannot be null!");
    String host = connectorType.getMetadata().get(HOST);
    Assert.notNull(host, "Host cannot be null!");
    String database = connectorType.getMetadata().get(DATABASE);
    Assert.notNull(database, "Database cannot be null!");
    String table = connectorType.getMetadata().get(TABLE);
    Assert.notNull(table, "Table cannot be null!");
    String keyColumn = connectorType.getMetadata().get(KEY_COLUMN);
    Assert.notNull(keyColumn, "Key column cannot be null!");
    String authenticationType = connectorType.getMetadata().get(AUTHENTICATION_TYPE_KEY);
    Assert.notNull(authenticationType, "Authentication type cannot be null!");
    String domain = connectorType.getMetadata().get(DOMAIN_KEY);
    String instanceName = connectorType.getMetadata().get(INSTANCE_NAME_KEY);
    String ntlmString = connectorType.getMetadata().get(NTLM_SWITCH);
    boolean ntlm = Boolean.parseBoolean(ntlmString);
    String trustServerCrtString = connectorType.getMetadata().get(TRUST_SERVER_CRT_SWITCH);
    boolean trustServerCrt = Boolean.parseBoolean(trustServerCrtString);
    // User and password is mandatory only for SQL Server authentication type or for NTLM
    String user = connectorType.getMetadata().get(USER);
    boolean passwordIsMandatory = false;
    if (authenticationType.equals(SQL_SERVER_AUTHENTICATION_TYPE) || (authenticationType.equals(WINDOWS_AUTHENTICATION_TYPE) && ntlm)) {
        Assert.notNull(user, "Username cannot be null!");
        passwordIsMandatory = true;
    }
    String password = connectorType.getMetadata().get(PASSWORD);
    if (Strings.isBlank(password) && !passwordIsMandatory) {
        // Password is null and is not mandatory, but connector wants it -> random value.
        password = "random_password";
    }
    // Remove password from metadata.
    connectorType.getMetadata().remove(PASSWORD);
    String systemId = connectorType.getMetadata().get(SYSTEM_DTO_KEY);
    SysSystemDto systemDto;
    if (systemId != null) {
        // System already exists.
        systemDto = getSystemService().get(UUID.fromString(systemId), IdmBasePermission.READ);
    } else {
        // Create new system.
        systemDto = new SysSystemDto();
    }
    systemDto.setName(connectorType.getMetadata().get(SYSTEM_NAME));
    // Resolve remote system.
    systemDto.setRemoteServer(connectorType.getRemoteServer());
    // Find connector key and set it to the system.
    IcConnectorKey connectorKey = getConnectorManager().findConnectorKey(connectorType);
    Assert.notNull(connectorKey, "Connector key was not found!");
    systemDto.setConnectorKey(new SysConnectorKeyDto(connectorKey));
    systemDto = getSystemService().save(systemDto, IdmBasePermission.CREATE);
    // Put new system to the connector type (will be returned to FE).
    connectorType.getEmbedded().put(SYSTEM_DTO_KEY, systemDto);
    IdmFormDefinitionDto connectorFormDef = this.getSystemService().getConnectorFormDefinition(systemDto);
    // Set the port.
    this.setValueToConnectorInstance(PORT, port, systemDto, connectorFormDef);
    // Set the host.
    this.setValueToConnectorInstance(HOST, host, systemDto, connectorFormDef);
    // Set the database.
    this.setValueToConnectorInstance(DATABASE, database, systemDto, connectorFormDef);
    // Set the table.
    this.setValueToConnectorInstance(TABLE, table, systemDto, connectorFormDef);
    // Set the user.
    this.setValueToConnectorInstance(USER, user, systemDto, connectorFormDef);
    // Set the password.
    // Password is mandatory only if none exists in connector configuration and for SQL Server authentication type or for NTLM.
    String passwordInSystem = this.getValueFromConnectorInstance(PASSWORD, systemDto, connectorFormDef);
    if (Strings.isNotBlank(password) && !GuardedString.SECRED_PROXY_STRING.equals(password)) {
        this.setValueToConnectorInstance(PASSWORD, password, systemDto, connectorFormDef);
    } else if (passwordIsMandatory) {
        Assert.notNull(passwordInSystem, "Password cannot be null!");
    }
    // Set the JDBC driver.
    this.setValueToConnectorInstance(JDBC_DRIVER, getJdbcDriverName(), systemDto, connectorFormDef);
    // Compile JDBC url with additional parameters.
    String jdbcUrlTemplate = getJdbcUrlTemplate();
    if (connectorType.isReopened()) {
        // For reopen system will be used persisted url.
        String jdbcUrlTemplateOriginal = getValueFromConnectorInstance(JDBC_URL_TEMPLATE, systemDto, connectorFormDef);
        if (Strings.isNotBlank(jdbcUrlTemplateOriginal)) {
            jdbcUrlTemplate = jdbcUrlTemplateOriginal;
        }
    }
    String jdbcUrl = compileJdbcUrl(jdbcUrlTemplate, authenticationType, ntlm, trustServerCrt, domain, instanceName);
    // Set the JDBC url template.
    this.setValueToConnectorInstance(JDBC_URL_TEMPLATE, jdbcUrl, systemDto, connectorFormDef);
    // Set the column with PK.
    this.setValueToConnectorInstance(KEY_COLUMN, keyColumn, systemDto, connectorFormDef);
    // Generate schema
    try {
        List<SysSchemaObjectClassDto> schemas = this.getSystemService().generateSchema(systemDto);
        SysSchemaObjectClassDto schemaAccount = schemas.stream().filter(schema -> IcObjectClassInfo.ACCOUNT.equals(schema.getObjectClassName())).findFirst().orElse(null);
        Assert.notNull(schemaAccount, "We cannot found schema for ACCOUNT!");
        connectorType.getMetadata().put(SCHEMA_ID_KEY, schemaAccount.getId().toString());
    } catch (ResultCodeException ex) {
        // Throw nice exception if lib for Windows authentication missing.
        Throwable cause = ex.getCause();
        if (cause.getMessage().contains("This driver is not configured for integrated authentication.")) {
            Throwable linked = cause.getCause();
            if (linked instanceof SQLException) {
                Throwable missingDriverEx = linked.getCause();
                if (missingDriverEx != null) {
                    String missingDriverExMessage = missingDriverEx.getMessage();
                    if (missingDriverExMessage.length() > 120) {
                        missingDriverExMessage = missingDriverExMessage.substring(0, 119) + "...";
                    }
                    throw new ResultCodeException(AccResultCode.WIZARD_MSSQL_CONNECTOR_LIB_MISSING, ImmutableMap.of("text", missingDriverExMessage), ex);
                }
            }
        }
        throw ex;
    }
}
Also used : SysConnectorKeyDto(eu.bcvsolutions.idm.acc.dto.SysConnectorKeyDto) SQLException(java.sql.SQLException) IcConnectorKey(eu.bcvsolutions.idm.ic.api.IcConnectorKey) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 97 with SysSchemaObjectClassDto

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

the class SystemExportBulkAction method exportSchema.

/**
 * Export system schemas
 *
 * @param systemId
 */
private void exportSchema(UUID systemId) {
    SysSchemaObjectClassFilter objectClassFilter = new SysSchemaObjectClassFilter();
    objectClassFilter.setSystemId(systemId);
    List<SysSchemaObjectClassDto> objectClasses = objectClassService.find(objectClassFilter, null).getContent();
    if (objectClasses.isEmpty()) {
        schemaObjectClassService.export(ExportManager.BLANK_UUID, getBatch());
    }
    objectClasses.forEach(schema -> {
        schemaObjectClassService.export(schema.getId(), getBatch());
    });
    // Set parent field -> set authoritative mode.
    this.getExportManager().setAuthoritativeMode(SysSchemaObjectClass_.system.getName(), "systemId", SysSchemaObjectClassDto.class, getBatch());
}
Also used : SysSchemaObjectClassFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaObjectClassFilter) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)

Example 98 with SysSchemaObjectClassDto

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

the class AbstractJdbcConnectorType method executeStepOne.

/**
 * Execute first step of JDBC wizard.
 *
 * @param connectorType
 */
protected void executeStepOne(ConnectorTypeDto connectorType) {
    String port = connectorType.getMetadata().get(PORT);
    Assert.notNull(port, "Port cannot be null!");
    String host = connectorType.getMetadata().get(HOST);
    Assert.notNull(host, "Host cannot be null!");
    String database = connectorType.getMetadata().get(DATABASE);
    Assert.notNull(database, "Database cannot be null!");
    String table = connectorType.getMetadata().get(TABLE);
    Assert.notNull(table, "Table cannot be null!");
    String keyColumn = connectorType.getMetadata().get(KEY_COLUMN);
    Assert.notNull(keyColumn, "Key column cannot be null!");
    String user = connectorType.getMetadata().get(USER);
    Assert.notNull(user, "Username cannot be null!");
    String password = connectorType.getMetadata().get(PASSWORD);
    // Remove password from metadata.
    connectorType.getMetadata().remove(PASSWORD);
    String systemId = connectorType.getMetadata().get(SYSTEM_DTO_KEY);
    SysSystemDto systemDto;
    if (systemId != null) {
        // System already exists.
        systemDto = getSystemService().get(UUID.fromString(systemId), IdmBasePermission.READ);
    } else {
        // Create new system.
        systemDto = new SysSystemDto();
    }
    systemDto.setName(connectorType.getMetadata().get(SYSTEM_NAME));
    // Resolve remote system.
    systemDto.setRemoteServer(connectorType.getRemoteServer());
    // Find connector key and set it to the system.
    IcConnectorKey connectorKey = connectorManager.findConnectorKey(connectorType);
    Assert.notNull(connectorKey, "Connector key was not found!");
    systemDto.setConnectorKey(new SysConnectorKeyDto(connectorKey));
    systemDto = getSystemService().save(systemDto, IdmBasePermission.CREATE);
    // Put new system to the connector type (will be returned to FE).
    connectorType.getEmbedded().put(SYSTEM_DTO_KEY, systemDto);
    IdmFormDefinitionDto connectorFormDef = this.getSystemService().getConnectorFormDefinition(systemDto);
    // Set the port.
    this.setValueToConnectorInstance(PORT, port, systemDto, connectorFormDef);
    // Set the host.
    this.setValueToConnectorInstance(HOST, host, systemDto, connectorFormDef);
    // Set the database.
    this.setValueToConnectorInstance(DATABASE, database, systemDto, connectorFormDef);
    // Set the table.
    this.setValueToConnectorInstance(TABLE, table, systemDto, connectorFormDef);
    // Set the user.
    this.setValueToConnectorInstance(USER, user, systemDto, connectorFormDef);
    // Set the password.
    // Password is mandatory only if none exists in connector configuration.
    String passwordInSystem = this.getValueFromConnectorInstance(PASSWORD, systemDto, connectorFormDef);
    if (Strings.isNotBlank(password) && !GuardedString.SECRED_PROXY_STRING.equals(password)) {
        this.setValueToConnectorInstance(PASSWORD, password, systemDto, connectorFormDef);
    } else {
        Assert.notNull(passwordInSystem, "Password cannot be null!");
    }
    // Set the JDBC driver.
    this.setValueToConnectorInstance(JDBC_DRIVER, getJdbcDriverName(), systemDto, connectorFormDef);
    // Set the JDBC url template.
    this.setValueToConnectorInstance(JDBC_URL_TEMPLATE, getJdbcUrlTemplate(), systemDto, connectorFormDef);
    // Set the column with PK.
    this.setValueToConnectorInstance(KEY_COLUMN, keyColumn, systemDto, connectorFormDef);
    // Generate schema
    List<SysSchemaObjectClassDto> schemas = this.getSystemService().generateSchema(systemDto);
    SysSchemaObjectClassDto schemaAccount = schemas.stream().filter(schema -> IcObjectClassInfo.ACCOUNT.equals(schema.getObjectClassName())).findFirst().orElse(null);
    Assert.notNull(schemaAccount, "We cannot found schema for ACCOUNT!");
    connectorType.getMetadata().put(SCHEMA_ID_KEY, schemaAccount.getId().toString());
}
Also used : SysConnectorKeyDto(eu.bcvsolutions.idm.acc.dto.SysConnectorKeyDto) IcConnectorKey(eu.bcvsolutions.idm.ic.api.IcConnectorKey) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 99 with SysSchemaObjectClassDto

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

the class RoleSynchronizationExecutor method resolveAssignRole.

private boolean resolveAssignRole(boolean isNew, SynchronizationContext context, IdmRoleDto roleDto, SysSyncRoleConfigDto config, SysSyncItemLogDto logItem, IcConnectorObject connectorObject, SysSystemAttributeMappingDto memberOfAttributeDto, SysSchemaObjectClassDto schemaObjectClassDto) {
    // Find attribute for get members (DNs)
    SysSystemAttributeMappingDto roleMembersAttributeDto = context.getMappedAttributes().stream().filter(attribute -> !attribute.isDisabledAttribute() && attribute.isEntityAttribute() && ROLE_MEMBERS_FIELD.equals(attribute.getIdmPropertyName())).findFirst().orElse(null);
    Assert.notNull(roleMembersAttributeDto, "Mapped attribute with role's members was not found. Please create it!");
    if (!isNew && AttributeMappingStrategyType.CREATE == roleMembersAttributeDto.getStrategyType()) {
        addToItemLog(logItem, "The attribute with role's members has strategy set to 'Set only for new entity'. Role isn't new, so resolving controlling an assignment of roles to users by the external system will be skipped for this role.");
    } else {
        addToItemLog(logItem, "Controlling an assignment of roles to users by the external system is activated.");
        Object membersObj = this.getValueByMappedAttribute(roleMembersAttributeDto, connectorObject.getAttributes(), context);
        if (membersObj == null) {
            membersObj = Lists.newArrayList();
        }
        if (membersObj instanceof String) {
            membersObj = Lists.newArrayList(membersObj);
        }
        Assert.isInstanceOf(List.class, membersObj, "The value from attribute with role's members must be List of Strings!");
        @SuppressWarnings("unchecked") List<String> members = (List<String>) membersObj;
        SysRoleSystemDto roleSystemDto = findRoleSystemDto(roleDto, memberOfAttributeDto, schemaObjectClassDto);
        if (roleSystemDto == null) {
            addToItemLog(logItem, "Relation between this role and system was not found. Assigning of role to users will be skip for this role.");
            return false;
        }
        SysRoleSystemAttributeDto memberAttribute = findMemberAttribute(memberOfAttributeDto, schemaObjectClassDto, roleSystemDto);
        if (memberAttribute == null) {
            addToItemLog(logItem, "The member attribute between this role and system was not found. Assigning of role to users will be skip for this role.");
            return false;
        }
        // Find identities with this role.
        IdmIdentityRoleFilter identityRoleFilter = new IdmIdentityRoleFilter();
        identityRoleFilter.setRoleId(roleDto.getId());
        List<IdmIdentityRoleDto> existsIdentityRoleDtos = identityRoleService.find(identityRoleFilter, null).getContent();
        // Get cache with users (DN vs UID).
        Map<String, String> usersUidCache = getUserUidCache();
        SysSchemaAttributeDto memberIdentifierAttribute = lookupService.lookupEmbeddedDto(config, SysSyncRoleConfig_.memberIdentifierAttribute);
        Assert.notNull(memberIdentifierAttribute, "User identifier attribute cannot be null!");
        Set<String> membersUid = Sets.newHashSet();
        Set<UUID> membersContractIds = Sets.newHashSet();
        // Call user system for every member (if isn't already in the cache).
        SysSystemDto userSystemDto = systemService.get(roleSystemDto.getSystem());
        IcConnectorConfiguration icConfig = systemService.getConnectorConfiguration(userSystemDto);
        IcConnectorInstance connectorInstance = systemService.getConnectorInstance(userSystemDto);
        IcObjectClass objectClass = new IcObjectClassImpl(schemaObjectClassDto.getObjectClassName());
        if (icConfig instanceof IcConnectorConfigurationImpl) {
            // Enable pooling - a performance reason.
            IcConnectorConfigurationImpl icConfigImpl = (IcConnectorConfigurationImpl) icConfig;
            icConfigImpl.setConnectorPoolingSupported(true);
        }
        final int[] count = { 0 };
        for (String member : members) {
            if (!transformDnToUid(config, usersUidCache, memberIdentifierAttribute, membersUid, icConfig, connectorInstance, objectClass, count, member)) {
                return false;
            }
        }
        count[0] = 0;
        membersUid.forEach(uid -> assignMissingIdentityRoles(roleDto, config, logItem, existsIdentityRoleDtos, membersContractIds, userSystemDto, count, uid, context));
        if (!checkForCancelAndFlush(config)) {
            return false;
        }
        // Remove redundant identity roles.
        List<IdmIdentityRoleDto> redundantIdentityRoles = existsIdentityRoleDtos.stream().filter(existsIdentityRole -> !membersContractIds.contains(existsIdentityRole.getIdentityContract())).collect(Collectors.toList());
        count[0] = 0;
        redundantIdentityRoles.forEach(redundantIdentityRole -> removeRedundantIdentityRoles(roleDto, config, logItem, count, redundantIdentityRole));
    }
    return true;
}
Also used : IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) EntityAccountDto(eu.bcvsolutions.idm.acc.dto.EntityAccountDto) SysSystemAttributeMapping_(eu.bcvsolutions.idm.acc.entity.SysSystemAttributeMapping_) IcConnectorInstance(eu.bcvsolutions.idm.ic.api.IcConnectorInstance) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) EntityAccountService(eu.bcvsolutions.idm.acc.service.api.EntityAccountService) Map(java.util.Map) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) AccRoleAccountDto(eu.bcvsolutions.idm.acc.dto.AccRoleAccountDto) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) IcFilter(eu.bcvsolutions.idm.ic.filter.api.IcFilter) Set(java.util.Set) Serializable(java.io.Serializable) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) IdmRoleCatalogueService(eu.bcvsolutions.idm.core.api.service.IdmRoleCatalogueService) SysRoleSystemAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysRoleSystemAttributeFilter) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) IdmRoleRequest_(eu.bcvsolutions.idm.core.model.entity.IdmRoleRequest_) IdmRoleCatalogueRole_(eu.bcvsolutions.idm.core.model.entity.IdmRoleCatalogueRole_) RoleEvent(eu.bcvsolutions.idm.core.model.event.RoleEvent) SysRoleSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.SysRoleSystemFilter) AbstractDto(eu.bcvsolutions.idm.core.api.dto.AbstractDto) Lists(com.google.common.collect.Lists) LookupService(eu.bcvsolutions.idm.core.api.service.LookupService) SysSystemEntityFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemEntityFilter) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) RoleEventType(eu.bcvsolutions.idm.core.model.event.RoleEvent.RoleEventType) SysRoleSystemAttributeService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService) SysSyncActionLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto) IcFilterBuilder(eu.bcvsolutions.idm.ic.filter.impl.IcFilterBuilder) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) RoleRequestState(eu.bcvsolutions.idm.core.api.domain.RoleRequestState) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) AccRoleAccountService(eu.bcvsolutions.idm.acc.service.api.AccRoleAccountService) IdmIdentityContract_(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract_) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) IcConnectorConfigurationImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl) SynchronizationContext(eu.bcvsolutions.idm.acc.domain.SynchronizationContext) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SynchronizationEntityExecutor(eu.bcvsolutions.idm.acc.service.api.SynchronizationEntityExecutor) ConceptRoleRequestOperation(eu.bcvsolutions.idm.core.api.domain.ConceptRoleRequestOperation) OperationResultType(eu.bcvsolutions.idm.acc.domain.OperationResultType) RoleType(eu.bcvsolutions.idm.core.api.domain.RoleType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) AccRoleAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccRoleAccountFilter) IdmRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmRoleRequestService) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) SysSchemaAttribute_(eu.bcvsolutions.idm.acc.entity.SysSchemaAttribute_) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IdmRoleCatalogueRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueRoleFilter) ImmutableMap(com.google.common.collect.ImmutableMap) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) IdmRoleCatalogue_(eu.bcvsolutions.idm.core.model.entity.IdmRoleCatalogue_) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) List(java.util.List) EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter) IdmRoleCatalogueFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueFilter) AccIdentityAccountService(eu.bcvsolutions.idm.acc.service.api.AccIdentityAccountService) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) AccAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) RoleRequestApprovalProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleRequestApprovalProcessor) IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) IdmIdentityRole_(eu.bcvsolutions.idm.core.model.entity.IdmIdentityRole_) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) HashMap(java.util.HashMap) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AtomicReference(java.util.concurrent.atomic.AtomicReference) MessageFormat(java.text.MessageFormat) SynchronizationActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationActionType) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) CorrelationFilter(eu.bcvsolutions.idm.core.api.dto.filter.CorrelationFilter) IdmRoleCatalogueRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueRoleDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSyncRoleConfig_(eu.bcvsolutions.idm.acc.entity.SysSyncRoleConfig_) IdmRoleCatalogueRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleCatalogueRoleService) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) Component(org.springframework.stereotype.Component) RoleRequestEvent(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) Assert(org.springframework.util.Assert) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcConnectorConfigurationImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) IcConnectorInstance(eu.bcvsolutions.idm.ic.api.IcConnectorInstance) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) List(java.util.List) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) UUID(java.util.UUID)

Example 100 with SysSchemaObjectClassDto

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

the class RoleSynchronizationExecutor method checkForwardAcmChange.

/**
 * Check if forward ACM value is different then value form a transformation.
 */
private void checkForwardAcmChange(IdmRoleDto dto, SynchronizationContext context, String attributeProperty, Object transformedValue) {
    if (!context.isEntityDifferent() && dto.getId() != null && getConfig(context).isForwardAcmSwitch()) {
        // 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!");
        boolean forwardAcmFromValue = getForwardAcmFromValue(transformedValue);
        SysRoleSystemDto roleSystemDto = findRoleSystemDto(dto, memberOfAttributeDto, schemaObjectClassDto);
        if (roleSystemDto == null || roleSystemDto.isForwardAccountManagemen() != forwardAcmFromValue) {
            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)

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