use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto in project CzechIdMng by bcvsolutions.
the class IdentityRoleSaveProvisioningProcessor method process.
@Override
public EventResult<IdmIdentityRoleDto> process(EntityEvent<IdmIdentityRoleDto> event) {
IdmIdentityRoleDto identityRole = event.getContent();
IdmIdentityContractDto identityContract = identityContractService.get(identityRole.getIdentityContract());
IdmIdentityDto identity = DtoUtils.getEmbedded(identityContract, IdmIdentityContract_.identity, IdmIdentityDto.class);
//
// TODO: full account management should be moved into NOTIFY on identity => super owner id can be removed then in IdentityRolePublishChangeProcessor
// all identity roles are processed now => doesn't support concurrency - duplicate accounts can be created now (ux constraint ex. is thrown)
LOG.debug("Call account management for identity [{}]", identity.getUsername());
provisioningService.accountManagement(identity);
LOG.debug("Register change for identity [{}]", identity.getUsername());
entityEventManager.changedEntity(identity, event);
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto in project CzechIdMng by bcvsolutions.
the class AbstractWorkflowEventProcessor method processInstance.
/**
* Execute wf - returns process instance
*
* @param variables
* @return
*/
protected ProcessInstance processInstance(Map<String, Object> variables) {
if (StringUtils.isEmpty(getWorkflowDefinitionKey())) {
// wf is not configured
return null;
}
// execute process
AbstractAuthentication authentication = securityService.getAuthentication();
IdmIdentityDto modifier = authentication == null ? null : authentication.getCurrentIdentity();
return workflowService.startProcess(getWorkflowDefinitionKey(), modifier == null ? null : modifier.getClass().getSimpleName(), authentication == null ? null : authentication.getCurrentUsername(), modifier == null || modifier.getId() == null ? null : modifier.getId().toString(), variables);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto in project CzechIdMng by bcvsolutions.
the class IdentityContractExclusionProcessor method process.
/**
* Check identity state after contract is excluded
*
* @param contract
* @param skipRecalculation Skip automatic role recalculation
* @return
*/
public OperationResult process(IdmIdentityContractDto contract, Boolean skipRecalculation) {
IdmIdentityDto identity = identityService.get(contract.getIdentity());
IdentityState newState = identityService.evaluateState(identity.getId());
//
if (identity.getState() != newState) {
LOG.info("Change identity [{}] state [{}]", identity.getUsername(), newState);
//
identity.setState(newState);
// is necessary publish new event with skip recalculation automatic roles
IdentityEvent identityEvent = new IdentityEvent(IdentityEventType.UPDATE, identity);
identityEvent.getProperties().put(IdmAutomaticRoleAttributeService.SKIP_RECALCULATION, skipRecalculation);
identityService.publish(identityEvent);
}
return new OperationResult.Builder(OperationState.EXECUTED).build();
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto in project CzechIdMng by bcvsolutions.
the class IdentityContractSaveProcessor method process.
@Override
public EventResult<IdmIdentityContractDto> process(EntityEvent<IdmIdentityContractDto> event) {
IdmIdentityContractDto contract = event.getContent();
contract = service.saveInternal(contract);
event.setContent(contract);
//
// check identity state
IdmIdentityContractDto previousContract = event.getOriginalSource();
IdmIdentityDto identity = DtoUtils.getEmbedded(contract, IdmIdentityContract_.identity.getName(), IdmIdentityDto.class);
if ((identity.getState() == IdentityState.CREATED || identity.isDisabled()) && contractChanged(previousContract, contract)) {
// synchronize identity states, which has no effect on HR processes
identity = identityService.get(contract.getIdentity());
IdentityState newState = identityService.evaluateState(identity.getId());
if (newState.isDisabled() && identity.getState() != newState) {
identity.setState(newState);
// publish new save event for identity with skip recalculation
IdentityEvent identityEvent = new IdentityEvent(IdentityEventType.UPDATE, identity);
identityEvent.getProperties().put(IdmAutomaticRoleAttributeService.SKIP_RECALCULATION, true);
identityService.publish(identityEvent);
}
}
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto in project CzechIdMng by bcvsolutions.
the class AbstractIdentityPasswordProcessor method process.
@Override
public EventResult<IdmIdentityDto> process(EntityEvent<IdmIdentityDto> event) {
IdmIdentityDto identity = event.getContent();
PasswordChangeDto passwordChangeDto = (PasswordChangeDto) event.getProperties().get(PROPERTY_PASSWORD_CHANGE_DTO);
Assert.notNull(passwordChangeDto);
//
if (passwordChangeDto.isIdm()) {
// change identity's password
savePassword(identity, passwordChangeDto);
Map<String, Object> parameters = new LinkedHashMap<>();
parameters.put("account", new IdmAccountDto(identity.getId(), true, identity.getUsername()));
return new DefaultEventResult.Builder<>(event, this).setResult(new OperationResult.Builder(OperationState.EXECUTED).setModel(new DefaultResultModel(CoreResultCode.PASSWORD_CHANGE_ACCOUNT_SUCCESS, parameters)).build()).build();
}
return new DefaultEventResult<>(event, this);
}
Aggregations