Search in sources :

Example 6 with DefaultEventResult

use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.

the class PasswordPolicySaveProcessor method process.

@Override
public EventResult<IdmPasswordPolicyDto> process(EntityEvent<IdmPasswordPolicyDto> event) {
    IdmPasswordPolicyDto dto = event.getContent();
    // 
    if (validatePasswordPolicyAttributes(dto)) {
        if (dto.isDefaultPolicy()) {
            this.passwordPolicyRepository.updateDefaultPolicyByType(dto.getType(), dto.getId());
        }
    } else {
        throw new ResultCodeException(CoreResultCode.PASSWORD_POLICY_DEFAULT_TYPE, ImmutableMap.of("name", dto.getName()));
    }
    // 
    dto = passwordPolicyService.saveInternal(dto);
    event.setContent(dto);
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : IdmPasswordPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult)

Example 7 with DefaultEventResult

use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.

the class AutomaticRoleAttributeRuleConceptProcessor method process.

@Override
public EventResult<IdmAutomaticRoleAttributeRuleDto> process(EntityEvent<IdmAutomaticRoleAttributeRuleDto> event) {
    IdmAutomaticRoleAttributeRuleDto dto = event.getContent();
    IdmAutomaticRoleAttributeDto automaticRole = automactiRoleAttributeService.get(dto.getAutomaticRoleAttribute());
    // 
    if (automaticRole == null) {
        throw new IllegalStateException("Automatic role [" + dto.getAutomaticRoleAttribute() + "] is null. Please check this rule: " + dto.getId());
    }
    // set concept
    if (!automaticRole.isConcept()) {
        automaticRole.setConcept(true);
        automaticRole = automactiRoleAttributeService.save(automaticRole);
    }
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IdmAutomaticRoleAttributeRuleDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeRuleDto) IdmAutomaticRoleAttributeDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto)

Example 8 with DefaultEventResult

use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.

the class AutomaticRoleRequestRealizationProcessor method process.

@Override
public EventResult<IdmAutomaticRoleRequestDto> process(EntityEvent<IdmAutomaticRoleRequestDto> event) {
    AbstractRequestDto dto = event.getContent();
    event.setContent(service.executeRequest(dto.getId()));
    return new DefaultEventResult<>(event, this);
}
Also used : DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) AbstractRequestDto(eu.bcvsolutions.idm.core.api.dto.AbstractRequestDto)

Example 9 with DefaultEventResult

use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.

the class RoleCatalogueSaveProcessor method process.

@Override
public EventResult<IdmRoleCatalogueDto> process(EntityEvent<IdmRoleCatalogueDto> event) {
    IdmRoleCatalogueDto dto = event.getContent();
    dto = service.saveInternal(dto);
    event.setContent(dto);
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto)

Example 10 with DefaultEventResult

use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.

the class TreeNodeDeleteProcessor method process.

@Override
public EventResult<IdmTreeNodeDto> process(EntityEvent<IdmTreeNodeDto> event) {
    IdmTreeNodeDto treeNode = event.getContent();
    // 
    if (identityContractRepository.countByWorkPosition_Id(treeNode.getId()) > 0) {
        throw new TreeNodeException(CoreResultCode.TREE_NODE_DELETE_FAILED_HAS_CONTRACTS, ImmutableMap.of("treeNode", treeNode.getName()));
    }
    // remove related automatic roles
    IdmRoleTreeNodeFilter filter = new IdmRoleTreeNodeFilter();
    filter.setTreeNodeId(treeNode.getId());
    roleTreeNodeService.find(filter, null).forEach(roleTreeNode -> {
        try {
            roleTreeNodeService.delete(roleTreeNode);
        } catch (AcceptedException ex) {
            throw new TreeNodeException(CoreResultCode.TREE_NODE_DELETE_FAILED_HAS_ROLE, ImmutableMap.of("treeNode", treeNode.getName(), "roleTreeNode", roleTreeNode.getId()));
        }
    });
    // 
    service.deleteInternal(treeNode);
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : IdmRoleTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleTreeNodeFilter) TreeNodeException(eu.bcvsolutions.idm.core.exception.TreeNodeException) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) AcceptedException(eu.bcvsolutions.idm.core.api.exception.AcceptedException)

Aggregations

DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)91 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)20 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)12 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)11 UUID (java.util.UUID)11 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)10 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)7 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)7 PasswordChangeDto (eu.bcvsolutions.idm.core.api.dto.PasswordChangeDto)6 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)5 IdmEntityEventDto (eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto)5 IdmPasswordPolicyDto (eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto)5 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)5 OperationResult (eu.bcvsolutions.idm.core.api.entity.OperationResult)5 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)4 AccIdentityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter)4 DefaultResultModel (eu.bcvsolutions.idm.core.api.dto.DefaultResultModel)4 IdmMessageDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto)4 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)4 ArrayList (java.util.ArrayList)4