Search in sources :

Example 1 with AccUniformPasswordSystemFilter

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

the class DefaultAccUniformPasswordServiceTest method testFilterUniformSystemSystemId.

@Test
public void testFilterUniformSystemSystemId() {
    SysSystemDto system = createSystem(true);
    SysSystemDto systemTwo = createSystem(true);
    AccUniformPasswordDto uniformDefinition = createUniformDefinition(true);
    assignSystem(uniformDefinition, system, systemTwo);
    AccUniformPasswordDto uniformDefinitionTwo = createUniformDefinition(true);
    assignSystem(uniformDefinitionTwo, systemTwo);
    AccUniformPasswordSystemFilter filter = new AccUniformPasswordSystemFilter();
    filter.setSystemId(system.getId());
    List<AccUniformPasswordSystemDto> content = uniformPasswordSystemService.find(filter, null).getContent();
    assertEquals(1, content.size());
    filter.setSystemId(systemTwo.getId());
    content = uniformPasswordSystemService.find(filter, null).getContent();
    assertEquals(2, content.size());
}
Also used : AccUniformPasswordSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordSystemFilter) AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) AccUniformPasswordSystemDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordSystemDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractPasswordFilterIntegrationTest(eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)

Example 2 with AccUniformPasswordSystemFilter

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

the class DefaultAccUniformPasswordServiceTest method testFilterByDisabledWithFalse.

@Test
public void testFilterByDisabledWithFalse() {
    SysSystemDto system = createSystem(false);
    SysSystemDto systemTwo = createSystem(false);
    SysSystemDto systemThree = createSystem(false);
    IdmIdentityDto identity = createIdentity(system);
    assignSystem(identity, systemTwo);
    assignSystem(identity, systemThree);
    AccUniformPasswordDto createUniformDefinition = createUniformDefinition(true);
    createUniformDefinition.setDisabled(true);
    createUniformDefinition = uniformPasswordService.save(createUniformDefinition);
    AccUniformPasswordDto createUniformDefinitionSecond = createUniformDefinition(true);
    assignSystem(createUniformDefinitionSecond, system, systemTwo, systemThree);
    assignSystem(createUniformDefinition, systemTwo);
    assignSystem(createUniformDefinition(true), system);
    AccUniformPasswordSystemFilter filter = new AccUniformPasswordSystemFilter();
    filter.setSystemId(systemTwo.getId());
    filter.setUniformPasswordDisabled(false);
    List<AccUniformPasswordSystemDto> content = uniformPasswordSystemService.find(filter, null).getContent();
    assertEquals(1, content.size());
    AccUniformPasswordSystemDto accUniformPasswordSystemDto = content.get(0);
    assertEquals(createUniformDefinitionSecond.getId(), accUniformPasswordSystemDto.getUniformPassword());
}
Also used : AccUniformPasswordSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordSystemFilter) AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) AccUniformPasswordSystemDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordSystemDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractPasswordFilterIntegrationTest(eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)

Example 3 with AccUniformPasswordSystemFilter

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

the class DefaultAccUniformPasswordServiceTest method testFilterByDisabledWithNull.

@Test
public void testFilterByDisabledWithNull() {
    SysSystemDto system = createSystem(false);
    SysSystemDto systemTwo = createSystem(false);
    SysSystemDto systemThree = createSystem(false);
    IdmIdentityDto identity = createIdentity(system);
    assignSystem(identity, systemTwo);
    assignSystem(identity, systemThree);
    AccUniformPasswordDto createUniformDefinition = createUniformDefinition(true);
    createUniformDefinition.setDisabled(true);
    createUniformDefinition = uniformPasswordService.save(createUniformDefinition);
    AccUniformPasswordDto createUniformDefinitionSecond = createUniformDefinition(true);
    assignSystem(createUniformDefinitionSecond, system, systemTwo, systemThree);
    assignSystem(createUniformDefinition, systemTwo);
    assignSystem(createUniformDefinition(true), system);
    AccUniformPasswordSystemFilter filter = new AccUniformPasswordSystemFilter();
    filter.setSystemId(systemTwo.getId());
    filter.setUniformPasswordDisabled(null);
    List<AccUniformPasswordSystemDto> content = uniformPasswordSystemService.find(filter, null).getContent();
    assertEquals(2, content.size());
}
Also used : AccUniformPasswordSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordSystemFilter) AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) AccUniformPasswordSystemDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordSystemDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractPasswordFilterIntegrationTest(eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)

Example 4 with AccUniformPasswordSystemFilter

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

the class UniformPasswordDeleteProcessor method process.

@Override
public EventResult<AccUniformPasswordDto> process(EntityEvent<AccUniformPasswordDto> event) {
    AccUniformPasswordDto uniformPasswordFilter = event.getContent();
    Assert.notNull(uniformPasswordFilter, "Uniform password cannot be null!");
    Assert.notNull(uniformPasswordFilter.getId(), "ID for uniform password must exists!");
    // Delete all connections with systems
    AccUniformPasswordSystemFilter uniformPasswordSystemFilter = new AccUniformPasswordSystemFilter();
    uniformPasswordSystemFilter.setUniformPasswordId(uniformPasswordFilter.getId());
    uniformPasswordSystemService.find(uniformPasswordSystemFilter, null).forEach(uniformPasswordSystem -> {
        uniformPasswordSystemService.delete(uniformPasswordSystem);
    });
    uniformPasswordService.deleteInternal(uniformPasswordFilter);
    return new DefaultEventResult<>(event, this);
}
Also used : AccUniformPasswordSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordSystemFilter) AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult)

Example 5 with AccUniformPasswordSystemFilter

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

the class SystemDeleteProcessor method process.

@Override
public EventResult<SysSystemDto> process(EntityEvent<SysSystemDto> event) {
    SysSystemDto system = event.getContent();
    Assert.notNull(system, "System is required.");
    // 
    // if exists provisioning operations, then is not possible to delete
    // system
    SysProvisioningOperationFilter operationFilter = new SysProvisioningOperationFilter();
    operationFilter.setSystemId(system.getId());
    if (provisioningOperationService.count(operationFilter) > 0) {
        throw new ResultCodeException(AccResultCode.SYSTEM_DELETE_FAILED_HAS_OPERATIONS, ImmutableMap.of("system", system.getName()));
    }
    if (accountRepository.countBySystem_Id(system.getId()) > 0) {
        throw new ResultCodeException(AccResultCode.SYSTEM_DELETE_FAILED_HAS_ACCOUNTS, ImmutableMap.of("system", system.getName()));
    }
    // Check if system is used in some systems group.
    SysSystemGroupSystemFilter groupSystemFilter = new SysSystemGroupSystemFilter();
    groupSystemFilter.setSystemId(system.getId());
    long count = systemGroupSystemService.count(groupSystemFilter);
    if (count > 0) {
        throw new ResultCodeException(AccResultCode.SYSTEM_DELETE_FAILED_HAS_SYSTEM_GROUPS, ImmutableMap.of("system", system.getName(), "count", count));
    }
    // delete system entities
    SysSystemEntityFilter systemEntityFilter = new SysSystemEntityFilter();
    systemEntityFilter.setSystemId(system.getId());
    systemEntityService.find(systemEntityFilter, null).forEach(systemEntity -> {
        systemEntityService.delete(systemEntity);
    });
    // delete synchronization configs
    SysSyncConfigFilter synchronizationConfigFilter = new SysSyncConfigFilter();
    synchronizationConfigFilter.setSystemId(system.getId());
    synchronizationConfigService.find(synchronizationConfigFilter, null).forEach(config -> {
        synchronizationConfigService.delete(config);
    });
    // delete schema
    SysSchemaObjectClassFilter filter = new SysSchemaObjectClassFilter();
    filter.setSystemId(system.getId());
    objectClassService.find(filter, null).forEach(schemaObjectClass -> {
        objectClassService.delete(schemaObjectClass);
    });
    // delete archived provisioning operations
    provisioningArchiveRepository.deleteBySystem_Id(system.getId());
    // 
    // clear provisioning break cache
    clearProvisioningBreakAndCache(system.getId());
    // 
    // deletes all confidential values
    confidentialStorage.deleteAll(system.getId(), SysSystem.class);
    // 
    // Delete connected uniform password. Or throw error at the beginning?
    AccUniformPasswordSystemFilter uniformPasswordSystemFilter = new AccUniformPasswordSystemFilter();
    uniformPasswordSystemFilter.setSystemId(system.getId());
    passwordFilterSystemService.find(uniformPasswordSystemFilter, null).forEach(uniformPasswordSystem -> {
        passwordFilterSystemService.delete(uniformPasswordSystem);
    });
    // 
    // deletes identity
    service.deleteInternal(system);
    return new DefaultEventResult<>(event, this);
}
Also used : SysSystemGroupSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemGroupSystemFilter) AccUniformPasswordSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordSystemFilter) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) SysSchemaObjectClassFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaObjectClassFilter) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) SysSystemEntityFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemEntityFilter) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Aggregations

AccUniformPasswordSystemFilter (eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordSystemFilter)7 AccUniformPasswordDto (eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto)6 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)6 AccUniformPasswordSystemDto (eu.bcvsolutions.idm.acc.dto.AccUniformPasswordSystemDto)5 AbstractPasswordFilterIntegrationTest (eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)4 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)4 Test (org.junit.Test)3 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)2 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 AccGroupPermission (eu.bcvsolutions.idm.acc.domain.AccGroupPermission)1 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)1 AccPasswordChangeOptionDto (eu.bcvsolutions.idm.acc.dto.AccPasswordChangeOptionDto)1 AccAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter)1 AccUniformPasswordFilter (eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordFilter)1 SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)1 SysSchemaObjectClassFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaObjectClassFilter)1 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)1 SysSystemEntityFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemEntityFilter)1 SysSystemGroupSystemFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemGroupSystemFilter)1