Search in sources :

Example 16 with SysProvisioningOperationFilter

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

the class SysProvisioningOperationFilterIntegrationTest method typeFilterTest.

@Test
public void typeFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SysSystemDto system = createSystem();
    createProvisioningOperation(SystemEntityType.CONTRACT, system);
    SysProvisioningOperationDto provisioningOperation2 = createProvisioningOperation(SystemEntityType.IDENTITY, system);
    SysProvisioningOperationDto provisioningOperation3 = createProvisioningOperation(SystemEntityType.CONTRACT, system);
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setSystemId(system.getId());
    filter.setEntityType(SystemEntityType.CONTRACT);
    Page<SysProvisioningOperationDto> result = operationService.find(filter, null, permission);
    assertEquals(2, result.getTotalElements());
    assertTrue(result.getContent().contains(provisioningOperation3));
    assertFalse(result.getContent().contains(provisioningOperation2));
}
Also used : SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 17 with SysProvisioningOperationFilter

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

the class SysProvisioningOperationFilterIntegrationTest method systemIdFilterTest.

@Test
public void systemIdFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    SysSystemDto system2 = createSystem();
    SysSystemDto system1 = createSystem();
    createProvisioningOperation(entityType, system2);
    SysProvisioningOperationDto provisioningOperation1 = createProvisioningOperation(entityType, system1);
    SysProvisioningOperationDto provisioningOperation2 = createProvisioningOperation(entityType, system2);
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setSystemId(system2.getId());
    Page<SysProvisioningOperationDto> result = operationService.find(filter, null, permission);
    assertEquals(2, result.getTotalElements());
    assertTrue(result.getContent().contains(provisioningOperation2));
    assertFalse(result.getContent().contains(provisioningOperation1));
}
Also used : SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 18 with SysProvisioningOperationFilter

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

the class SysProvisioningOperationFilterIntegrationTest method batchIdFilterTest.

@Test
public void batchIdFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    SysSystemDto system = createSystem();
    SysProvisioningBatchDto provisioningBatch = new SysProvisioningBatchDto();
    provisioningBatch = batchService.save(provisioningBatch);
    SysProvisioningOperationDto provisioningOperation1 = createProvisioningOperation(entityType, system);
    provisioningOperation1.setBatch(provisioningBatch.getId());
    provisioningOperation1 = operationService.save(provisioningOperation1);
    SysProvisioningOperationDto provisioningOperation2 = createProvisioningOperation(entityType, system);
    provisioningOperation2.setBatch(provisioningBatch.getId());
    provisioningOperation2 = operationService.save(provisioningOperation2);
    SysProvisioningOperationDto provisioningOperation3 = createProvisioningOperation(entityType, system);
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setSystemId(system.getId());
    filter.setBatchId(provisioningBatch.getId());
    Page<SysProvisioningOperationDto> result = operationService.find(filter, null, permission);
    assertEquals(2, result.getTotalElements());
    assertTrue(result.getContent().contains(provisioningOperation1));
    assertTrue(result.getContent().contains(provisioningOperation2));
    assertFalse(result.getContent().contains(provisioningOperation3));
}
Also used : SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysProvisioningBatchDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 19 with SysProvisioningOperationFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter 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);
    // 
    // if exists provisioning operations, then is not possible to delete
    // system
    SysProvisioningOperationFilter operationFilter = new SysProvisioningOperationFilter();
    operationFilter.setSystemId(system.getId());
    if (provisioningOperationRepository.find(operationFilter, null).getTotalElements() > 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()));
    }
    // 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);
    // 
    // deletes identity
    service.deleteInternal(system);
    return new DefaultEventResult<>(event, this);
}
Also used : 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)

Example 20 with SysProvisioningOperationFilter

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

the class SysProvisioningOperationController method cancelAll.

@ResponseBody
@PreAuthorize("hasAuthority('" + AccGroupPermission.SYSTEM_ADMIN + "')")
@RequestMapping(value = "/action/bulk/cancel", method = RequestMethod.PUT)
@ApiOperation(value = "Cancel provisioning queue", nickname = "cancelAllProvisioningQueue", tags = { SysProvisioningOperationController.TAG }, notes = "Cancel all operations from provisioning queue by given filter")
public ResponseEntity<?> cancelAll(@RequestParam(required = false) MultiValueMap<String, Object> parameters) {
    SysProvisioningOperationFilter filter = toFilter(parameters);
    // filter.setSystemId(getParameterConverter().toEntityUuid(parameters, "systemId", SysSystem.class));
    // 
    CancelProvisioningQueueTaskExecutor lrt = new CancelProvisioningQueueTaskExecutor();
    lrt.setFilter(filter);
    // 
    LongRunningFutureTask<Boolean> futureTask = longRunningTaskManager.execute(lrt);
    // 
    return new ResponseEntity<Object>(longRunningTaskManager.getLongRunningTask(futureTask), HttpStatus.ACCEPTED);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) CancelProvisioningQueueTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.CancelProvisioningQueueTaskExecutor) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)32 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)27 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)27 Test (org.junit.Test)27 SysProvisioningArchiveDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto)15 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)15 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)14 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)13 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)8 ProvisioningAttributeDto (eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto)7 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)6 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)6 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)6 SysProvisioningBatchDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto)4 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)4 IdmContractGuaranteeDto (eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto)4 OperationResult (eu.bcvsolutions.idm.core.api.entity.OperationResult)3 ProvisioningContext (eu.bcvsolutions.idm.acc.domain.ProvisioningContext)2 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)2 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)2