use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto in project CzechIdMng by bcvsolutions.
the class ProvisioningOperationRetryBulkAction method processDto.
@Override
protected OperationResult processDto(SysProvisioningOperationDto dto) {
if (isRetryWholeBatchAttribute()) {
SysProvisioningBatchDto batch = DtoUtils.getEmbedded(dto, SysProvisioningOperation_.batch, SysProvisioningBatchDto.class, null);
if (batch == null) {
batch = provisioningOperationBatchService.get(dto.getBatch());
}
provisioningExecutor.execute(batch);
} else {
provisioningExecutor.execute(dto);
}
return new OperationResult(OperationState.EXECUTED);
}
use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemEntityService method deleteInternal.
@Override
@Transactional
public void deleteInternal(SysSystemEntityDto systemEntity) {
Assert.notNull(systemEntity, "System entity is required.");
//
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setSystemId(systemEntity.getSystem());
filter.setEntityType(systemEntity.getEntityType());
filter.setSystemEntity(systemEntity.getId());
// TODO: transform this behavior to events
if (provisioningOperationService.count(filter) > 0) {
SysSystemDto system = DtoUtils.getEmbedded(systemEntity, SysSystemEntity_.system);
throw new ResultCodeException(AccResultCode.SYSTEM_ENTITY_DELETE_FAILED_HAS_OPERATIONS, ImmutableMap.of("uid", systemEntity.getUid(), "system", system.getName()));
}
//
// clear accounts - only link, can be rebuild
AccAccountFilter accountFilter = new AccAccountFilter();
accountFilter.setSystemEntityId(systemEntity.getId());
accountService.find(accountFilter, null).forEach(account -> {
account.setSystemEntity(null);
accountService.save(account);
});
//
// clear batches
SysProvisioningBatchDto batch = batchService.findBatch(systemEntity.getId());
if (batch != null) {
batchService.delete(batch);
}
//
super.deleteInternal(systemEntity);
}
use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto in project CzechIdMng by bcvsolutions.
the class SysProvisioningBatchController method retry.
@ResponseBody
@PreAuthorize("hasAuthority('" + AccGroupPermission.SYSTEM_ADMIN + "')")
@RequestMapping(value = "/{backendId}/retry", method = RequestMethod.PUT)
@ApiOperation(value = "Retry provisioning batch", nickname = "retryProvisioningBatch", tags = { SysProvisioningBatchController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_ADMIN, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_ADMIN, description = "") }) }, notes = "Retry all provisioning operations in given batch - retry all active operations in queue grouped by system entity ordered by incomming date.")
public ResponseEntity<?> retry(@ApiParam(value = "Provisioning batch's uuid identifier.", required = true) @PathVariable @NotNull String backendId) {
SysProvisioningBatchDto batch = getDto(backendId);
if (batch == null) {
throw new ResultCodeException(CoreResultCode.NOT_FOUND, ImmutableMap.of("entity", backendId));
}
provisioningExecutor.execute(batch);
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
}
use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto in project CzechIdMng by bcvsolutions.
the class SysProvisioningBatchController method cancel.
@ResponseBody
@PreAuthorize("hasAuthority('" + AccGroupPermission.SYSTEM_ADMIN + "')")
@RequestMapping(value = "/{backendId}/cancel", method = RequestMethod.PUT)
@ApiOperation(value = "Cance provisioning batch", nickname = "cancelProvisioningBatch", tags = { SysProvisioningBatchController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_ADMIN, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_ADMIN, description = "") }) }, notes = "Cancel all provisioning operations in given batch - cancel all active operations in queue grouped by system entity.")
public ResponseEntity<Void> cancel(@ApiParam(value = "Provisioning batch's uuid identifier.", required = true) @PathVariable @NotNull String backendId) {
SysProvisioningBatchDto batch = getDto(backendId);
if (batch == null) {
throw new ResultCodeException(CoreResultCode.NOT_FOUND, ImmutableMap.of("entity", backendId));
}
provisioningExecutor.cancel(batch);
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
}
use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto in project CzechIdMng by bcvsolutions.
the class ProvisioningBreakProcessorTest method testClearCache.
@Test
public void testClearCache() {
SysSystemDto system = getHelper().createTestResourceSystem(true);
IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
createProvisioningBreak(20l, 3, null, ProvisioningEventType.UPDATE, system.getId());
//
this.createAccount(system, identity);
//
// create
provisioningService.doProvisioning(identity);
//
SysSystemEntityDto systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, identity.getUsername());
SysProvisioningBatchDto batch = batchService.findBatch(systemEntity.getId());
List<SysProvisioningOperationDto> content = provisioningOperationService.findByBatchId(batch.getId(), null).getContent();
//
provisioningService.doProvisioning(identity);
//
content = provisioningOperationService.findByBatchId(batch.getId(), null).getContent();
//
provisioningService.doProvisioning(identity);
//
content = provisioningOperationService.findByBatchId(batch.getId(), null).getContent();
//
assertTrue(content.isEmpty());
//
SysBlockedOperationDto blockedOperation = new SysBlockedOperationDto();
blockedOperation.blockUpdate();
system.setBlockedOperation(blockedOperation);
// block system
system = systemService.save(system);
//
blockedOperation = new SysBlockedOperationDto();
blockedOperation.setUpdateOperation(Boolean.FALSE);
system.setBlockedOperation(blockedOperation);
// unblock system, clear cache
system = systemService.save(system);
//
provisioningService.doProvisioning(identity);
provisioningService.doProvisioning(identity);
//
systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, identity.getUsername());
batch = batchService.findBatch(systemEntity.getId());
//
assertEquals(0, provisioningOperationService.findByBatchId(batch.getId(), null).getTotalElements());
}
Aggregations