Search in sources :

Example 16 with IdmRoleRequestFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter in project CzechIdMng by bcvsolutions.

the class ChangeIdentityPermissionTest method testFindCandidatesWithSubprocess.

@Test
public void testFindCandidatesWithSubprocess() {
    ZonedDateTime now = ZonedDateTime.now().truncatedTo(ChronoUnit.MILLIS);
    getHelper().waitForResult(null, 1, 1);
    // approve only by help desk
    configurationService.setValue(APPROVE_BY_USERMANAGER_ENABLE, "false");
    configurationService.setValue(APPROVE_BY_SECURITY_ENABLE, "false");
    configurationService.setValue(APPROVE_BY_MANAGER_ENABLE, "false");
    configurationService.setValue(APPROVE_BY_HELPDESK_ENABLE, "true");
    loginAsAdmin();
    // helpdesk role and identity
    IdmRoleDto helpdeskRole = getHelper().createRole();
    IdmIdentityDto helpdeskIdentity = getHelper().createIdentity();
    // add role directly
    getHelper().createIdentityRole(helpdeskIdentity, helpdeskRole);
    configurationService.setValue(APPROVE_BY_HELPDESK_ROLE, helpdeskRole.getCode());
    IdmIdentityDto identity = identityService.getByUsername(InitTestDataProcessor.TEST_USER_1);
    IdmIdentityDto guarantee = identityService.getByUsername(InitTestDataProcessor.TEST_USER_2);
    // Guarantee
    int priority = 500;
    IdmRoleDto adminRole = roleConfiguration.getAdminRole();
    adminRole.setPriority(priority);
    getHelper().createRoleGuarantee(adminRole, guarantee);
    adminRole = roleService.save(adminRole);
    configurationService.setValue(IdmRoleService.WF_BY_ROLE_PRIORITY_PREFIX + priority, APPROVE_ROLE_BY_MANAGER_KEY);
    IdmIdentityContractDto contract = getHelper().getPrimeContract(identity.getId());
    IdmRoleRequestDto request = createRoleRequest(identity);
    request = roleRequestService.save(request);
    IdmConceptRoleRequestDto concept = createRoleConcept(adminRole, contract, request);
    concept = conceptRoleRequestService.save(concept);
    IdmRequestIdentityRoleFilter requestIdentityRoleFilter = new IdmRequestIdentityRoleFilter();
    requestIdentityRoleFilter.setIncludeCandidates(true);
    requestIdentityRoleFilter.setRoleRequestId(request.getId());
    requestIdentityRoleFilter.setIdentityId(identity.getId());
    List<IdmRequestIdentityRoleDto> requestIdentityRoles = requestIdentityRoleService.find(requestIdentityRoleFilter, null).getContent();
    assertEquals(1, requestIdentityRoles.size());
    IdmRequestIdentityRoleDto requestIdentityRoleDto = requestIdentityRoles.get(0);
    assertNull(requestIdentityRoleDto.getCandidates());
    roleRequestService.startRequestInternal(request.getId(), true);
    request = roleRequestService.get(request.getId());
    assertEquals(RoleRequestState.IN_PROGRESS, request.getState());
    WorkflowFilterDto taskFilter = new WorkflowFilterDto();
    taskFilter.setCreatedAfter(now);
    taskFilter.setCandidateOrAssigned(securityService.getCurrentUsername());
    List<WorkflowTaskInstanceDto> tasks = workflowTaskInstanceService.find(taskFilter, null).getContent();
    assertEquals(0, tasks.size());
    Set<IdmIdentityDto> candidates = workflowProcessInstanceService.getApproversForProcess(request.getWfProcessId());
    assertEquals(1, candidates.size());
    candidates = workflowProcessInstanceService.getApproversForSubprocess(request.getWfProcessId());
    assertEquals(0, candidates.size());
    requestIdentityRoleFilter = new IdmRequestIdentityRoleFilter();
    requestIdentityRoleFilter.setIncludeCandidates(true);
    requestIdentityRoleFilter.setRoleRequestId(request.getId());
    requestIdentityRoleFilter.setIdentityId(identity.getId());
    requestIdentityRoles = requestIdentityRoleService.find(requestIdentityRoleFilter, null).getContent();
    assertEquals(1, requestIdentityRoles.size());
    requestIdentityRoleDto = requestIdentityRoles.get(0);
    assertNull(requestIdentityRoleDto.getCandidates());
    IdmRoleRequestFilter filter = new IdmRoleRequestFilter();
    filter.setIncludeApprovers(true);
    IdmRoleRequestDto requestDto = roleRequestService.get(request.getId(), filter);
    assertEquals(1, requestDto.getApprovers().size());
    // HELPDESK
    loginAsAdmin(helpdeskIdentity.getUsername());
    taskFilter.setCandidateOrAssigned(helpdeskIdentity.getUsername());
    checkAndCompleteOneTask(taskFilter, InitTestDataProcessor.TEST_USER_1, "approve");
    filter.setIncludeApprovers(false);
    requestDto = roleRequestService.get(request.getId(), filter);
    assertNull(requestDto.getApprovers());
    // Subprocess - approve by Manager
    request = roleRequestService.get(request.getId());
    loginAsAdmin(guarantee.getUsername());
    taskFilter.setCandidateOrAssigned(InitTestDataProcessor.TEST_USER_2);
    tasks = workflowTaskInstanceService.find(taskFilter, null).getContent();
    assertEquals(1, tasks.size());
    concept = conceptRoleRequestService.get(concept.getId());
    String conceptWf = concept.getWfProcessId();
    assertNotNull(conceptWf);
    assertNotNull(workflowProcessInstanceService.get(conceptWf));
    candidates = workflowProcessInstanceService.getApproversForProcess(request.getWfProcessId());
    assertEquals(1, candidates.size());
    IdmIdentityDto approversFromProcess = candidates.stream().findFirst().get();
    candidates = workflowProcessInstanceService.getApproversForSubprocess(request.getWfProcessId());
    assertEquals(1, candidates.size());
    IdmIdentityDto approversFromSubProcess = candidates.stream().findFirst().get();
    assertEquals(approversFromProcess.getId(), approversFromSubProcess.getId());
    requestIdentityRoleFilter = new IdmRequestIdentityRoleFilter();
    requestIdentityRoleFilter.setIncludeCandidates(true);
    requestIdentityRoleFilter.setRoleRequestId(request.getId());
    requestIdentityRoleFilter.setIdentityId(identity.getId());
    requestIdentityRoles = requestIdentityRoleService.find(requestIdentityRoleFilter, null).getContent();
    assertEquals(1, requestIdentityRoles.size());
    requestIdentityRoleDto = requestIdentityRoles.get(0);
    assertEquals(1, requestIdentityRoleDto.getCandidates().size());
    requestIdentityRoleFilter.setIncludeCandidates(false);
    requestIdentityRoles = requestIdentityRoleService.find(requestIdentityRoleFilter, null).getContent();
    assertEquals(1, requestIdentityRoles.size());
    requestIdentityRoleDto = requestIdentityRoles.get(0);
    assertNull(requestIdentityRoleDto.getCandidates());
    filter = new IdmRoleRequestFilter();
    filter.setIncludeApprovers(true);
    requestDto = roleRequestService.get(request.getId(), filter);
    assertEquals(1, requestDto.getApprovers().size());
    filter.setIncludeApprovers(false);
    requestDto = roleRequestService.get(request.getId(), filter);
    assertNull(requestDto.getApprovers());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmRequestIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRequestIdentityRoleDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmRequestIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestIdentityRoleFilter) ZonedDateTime(java.time.ZonedDateTime) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) IdmRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) AbstractCoreWorkflowIntegrationTest(eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest) Test(org.junit.Test)

Example 17 with IdmRoleRequestFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter in project CzechIdMng by bcvsolutions.

the class DefaultTestHelper method startRequestInternal.

@Override
public IdmRoleRequestDto startRequestInternal(IdmRoleRequestDto roleRequest, boolean checkRight, boolean immediate) {
    Map<String, Serializable> properties = new HashMap<>();
    properties.put(RoleRequestProcessor.CHECK_RIGHT_PROPERTY, checkRight);
    CoreEvent<IdmRoleRequestDto> event = new CoreEvent<IdmRoleRequestDto>((EventType) () -> "EXCECUTE", roleRequest, properties);
    if (immediate) {
        event.setPriority(PriorityType.IMMEDIATE);
    }
    // 
    roleRequestService.startRequestInternal(event);
    // 
    return roleRequestService.get(roleRequest.getId(), new IdmRoleRequestFilter(true));
}
Also used : Serializable(java.io.Serializable) HashMap(java.util.HashMap) CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)

Example 18 with IdmRoleRequestFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter in project CzechIdMng by bcvsolutions.

the class IdentityDeleteBulkAction method end.

@Override
protected OperationResult end(OperationResult result, Exception exception) {
    if (exception != null || (result != null && OperationState.EXECUTED != result.getState())) {
        return super.end(result, exception);
    }
    // success - force by default
    for (UUID identityId : processedIds) {
        IdmIdentityDto identity = getService().get(identityId);
        if (identity != null) {
            // delete identity contracts => contract related records are  removed asynchornously, but contract itself will be removed here
            for (IdmIdentityContractDto contract : contractService.findAllByIdentity(identityId)) {
                // check assigned roles again - can be assigned in the meantime ...
                IdmIdentityRoleFilter identityRoleFilter = new IdmIdentityRoleFilter();
                UUID contractId = contract.getId();
                identityRoleFilter.setIdentityContractId(contractId);
                if (identityRoleService.count(identityRoleFilter) > 0) {
                    return super.end(result, new ResultCodeException(CoreResultCode.CONTRACT_DELETE_FAILED_ROLE_ASSIGNED, ImmutableMap.of("contract", contractId)));
                }
                contractService.deleteInternal(contract);
                // 
                LOG.debug("Contract [{}] deleted.", contractId);
                // clean up all states
                entityStateManager.deleteStates(contract, null, null);
            }
            // 
            // Delete all role requests where is this identity applicant - processed asynchronous requests should be deleted here
            IdmRoleRequestFilter roleRequestFilter = new IdmRoleRequestFilter();
            roleRequestFilter.setApplicantId(identityId);
            roleRequestService.find(roleRequestFilter, null).forEach(request -> {
                roleRequestService.delete(request);
            });
            // 
            identityService.deleteInternal(identity);
            // 
            LOG.debug("Identity [{}] deleted.", identity.getUsername());
        } else {
            LOG.debug("Identity [{}] already deleted.", identityId);
        }
        // clean up all states
        entityStateManager.deleteStates(new IdmIdentityDto(identityId), null, null);
    }
    return super.end(result, exception);
}
Also used : ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IdmRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter) UUID(java.util.UUID) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)

Example 19 with IdmRoleRequestFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleRequestService method executeRequestInternal.

private IdmRoleRequestDto executeRequestInternal(EntityEvent<IdmRoleRequestDto> requestEvent) {
    UUID requestId = requestEvent.getContent().getId();
    Assert.notNull(requestId, "Role request ID is required!");
    IdmRoleRequestDto request = this.get(requestId, new IdmRoleRequestFilter(true));
    Assert.notNull(request, "Role request is required!");
    List<IdmConceptRoleRequestDto> concepts = request.getConceptRoles();
    IdmIdentityDto identity = identityService.get(request.getApplicant());
    boolean identityNotSame = concepts.stream().anyMatch(concept -> {
        // get contract DTO from embedded map
        IdmIdentityContractDto contract = (IdmIdentityContractDto) concept.getEmbedded().get(IdmConceptRoleRequestService.IDENTITY_CONTRACT_FIELD);
        if (contract == null) {
            contract = identityContractService.get(concept.getIdentityContract());
        }
        Assert.notNull(contract, "Contract cannot be empty!");
        return !identity.getId().equals(contract.getIdentity());
    });
    if (identityNotSame) {
        throw new RoleRequestException(CoreResultCode.ROLE_REQUEST_APPLICANTS_NOT_SAME, ImmutableMap.of("request", request, "applicant", identity.getUsername()));
    }
    // Add changed identity-roles to event (prevent redundant search). We will used them for recalculations (ACM / provisioning).
    // Beware!! Sets have to be defined here, because without that will be not propagated to a sub event (role-request -> identity-role event)!
    requestEvent.getProperties().put(IdentityRoleEvent.PROPERTY_ASSIGNED_NEW_ROLES, Sets.newHashSet());
    requestEvent.getProperties().put(IdentityRoleEvent.PROPERTY_ASSIGNED_UPDATED_ROLES, Sets.newHashSet());
    requestEvent.getProperties().put(IdentityRoleEvent.PROPERTY_ASSIGNED_REMOVED_ROLES, Sets.newHashSet());
    requestEvent.getProperties().put(IdmAccountDto.IDENTITY_ACCOUNT_FOR_DELAYED_ACM, Sets.newHashSet());
    requestEvent.getProperties().put(IdmAccountDto.ACCOUNT_FOR_ADDITIONAL_PROVISIONING, Sets.newHashSet());
    // Remove not approved concepts.
    List<IdmConceptRoleRequestDto> approvedConcepts = concepts.stream().filter(concept -> {
        // approval event disabled).
        return RoleRequestState.APPROVED == concept.getState() || RoleRequestState.CONCEPT == concept.getState();
    }).collect(Collectors.toList());
    // Add concepts for business roles.
    List<IdmIdentityRoleDto> allAssignedRoles = identityRoleService.findAllByIdentity(identity.getId());
    List<IdmConceptRoleRequestDto> allApprovedConcepts = appendBusinessRoleConcepts(approvedConcepts, allAssignedRoles);
    // Create new identity role.
    allApprovedConcepts.stream().filter(concept -> ConceptRoleRequestOperation.ADD == concept.getOperation()).forEach(concept -> {
        if (!cancelInvalidConcept(allAssignedRoles, concept, request)) {
            // assign new role
            createAssignedRole(allApprovedConcepts, concept, request, requestEvent);
        }
        flushHibernateSession();
    });
    // Update identity role
    allApprovedConcepts.stream().filter(concept -> ConceptRoleRequestOperation.UPDATE == concept.getOperation()).forEach(concept -> {
        if (!cancelInvalidConcept(allAssignedRoles, concept, request)) {
            updateAssignedRole(allApprovedConcepts, concept, request, requestEvent);
        }
        flushHibernateSession();
    });
    // Delete identity sub roles at first (prevent to delete sub roles by referential integrity).
    allApprovedConcepts.stream().filter(concept -> ConceptRoleRequestOperation.REMOVE == concept.getOperation()).filter(concept -> concept.getDirectConcept() != null).forEach(concept -> {
        if (!cancelInvalidConcept(allAssignedRoles, concept, request)) {
            removeAssignedRole(concept, request, requestEvent);
        }
        flushHibernateSession();
    });
    // Delete direct identity role
    allApprovedConcepts.stream().filter(concept -> ConceptRoleRequestOperation.REMOVE == concept.getOperation()).filter(concept -> concept.getDirectConcept() == null).forEach(concept -> {
        if (!cancelInvalidConcept(allAssignedRoles, concept, request)) {
            removeAssignedRole(concept, request, requestEvent);
        }
        flushHibernateSession();
    });
    return this.save(request);
}
Also used : DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) ZonedDateTime(java.time.ZonedDateTime) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SiemLoggerManager(eu.bcvsolutions.idm.core.api.audit.service.SiemLoggerManager) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) StringUtils(org.apache.commons.lang3.StringUtils) SecurityService(eu.bcvsolutions.idm.core.security.api.service.SecurityService) Predicate(javax.persistence.criteria.Predicate) IdmConceptRoleRequest_(eu.bcvsolutions.idm.core.model.entity.IdmConceptRoleRequest_) Map(java.util.Map) CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) CriteriaQuery(javax.persistence.criteria.CriteriaQuery) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) Loggable(eu.bcvsolutions.idm.core.api.domain.Loggable) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) Set(java.util.Set) IdentityRoleEvent(eu.bcvsolutions.idm.core.model.event.IdentityRoleEvent) WorkflowHistoricProcessInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowHistoricProcessInstanceDto) Serializable(java.io.Serializable) IdmRoleRequestRepository(eu.bcvsolutions.idm.core.model.repository.IdmRoleRequestRepository) IOUtils(org.apache.commons.io.IOUtils) IdmRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter) IdmRoleRequest_(eu.bcvsolutions.idm.core.model.entity.IdmRoleRequest_) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) IdmAccountDto(eu.bcvsolutions.idm.core.api.dto.IdmAccountDto) IdmRoleCompositionDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto) Session(org.hibernate.Session) BooleanUtils(org.apache.commons.lang3.BooleanUtils) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) Strings(com.google.common.base.Strings) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) Lists(com.google.common.collect.Lists) Service(org.springframework.stereotype.Service) WorkflowProcessInstanceService(eu.bcvsolutions.idm.core.workflow.service.WorkflowProcessInstanceService) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) Root(javax.persistence.criteria.Root) WorkflowHistoricProcessInstanceService(eu.bcvsolutions.idm.core.workflow.service.WorkflowHistoricProcessInstanceService) DuplicateRolesDto(eu.bcvsolutions.idm.core.api.dto.DuplicateRolesDto) CoreException(eu.bcvsolutions.idm.core.api.exception.CoreException) AbstractEventableDtoService(eu.bcvsolutions.idm.core.api.service.AbstractEventableDtoService) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) IOException(java.io.IOException) RoleRequestState(eu.bcvsolutions.idm.core.api.domain.RoleRequestState) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) ConceptRoleRequestOperation(eu.bcvsolutions.idm.core.api.domain.ConceptRoleRequestOperation) IdmConceptRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmConceptRoleRequestFilter) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) IdmIdentityRoleThinService(eu.bcvsolutions.idm.core.api.service.thin.IdmIdentityRoleThinService) AuthorizableType(eu.bcvsolutions.idm.core.security.api.dto.AuthorizableType) IdmRoleRequestByIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestByIdentityDto) IdmConceptRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmConceptRoleRequestService) ByteArrayInputStream(org.fusesource.hawtbuf.ByteArrayInputStream) RoleRequestException(eu.bcvsolutions.idm.core.api.exception.RoleRequestException) WorkflowProcessInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto) IdmRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmRoleRequestService) CoreGroupPermission(eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IdmFormAttributeService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormAttributeService) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Objects(com.google.common.base.Objects) ImmutableMap(com.google.common.collect.ImmutableMap) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) IdmRoleCompositionService(eu.bcvsolutions.idm.core.api.service.IdmRoleCompositionService) IdmRoleRequest(eu.bcvsolutions.idm.core.model.entity.IdmRoleRequest) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) PriorityType(eu.bcvsolutions.idm.core.api.domain.PriorityType) List(java.util.List) ExceptionUtils(eu.bcvsolutions.idm.core.api.utils.ExceptionUtils) LocalDate(java.time.LocalDate) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) RoleRequestEventType(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent.RoleRequestEventType) RoleRequestApprovalProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleRequestApprovalProcessor) ValueGeneratorManager(eu.bcvsolutions.idm.core.api.service.ValueGeneratorManager) IdmIdentityRole_(eu.bcvsolutions.idm.core.model.entity.IdmIdentityRole_) RoleRequestedByType(eu.bcvsolutions.idm.core.api.domain.RoleRequestedByType) HashMap(java.util.HashMap) MessageFormat(java.text.MessageFormat) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) HashSet(java.util.HashSet) Propagation(org.springframework.transaction.annotation.Propagation) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) IdentityRoleEventType(eu.bcvsolutions.idm.core.model.event.IdentityRoleEvent.IdentityRoleEventType) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmRoleComposition_(eu.bcvsolutions.idm.core.model.entity.IdmRoleComposition_) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) PROPERTY_STATE(eu.bcvsolutions.idm.core.api.dto.OperationResultDto.PROPERTY_STATE) ApplicationContext(org.springframework.context.ApplicationContext) IdmIncompatibleRoleService(eu.bcvsolutions.idm.core.api.service.IdmIncompatibleRoleService) IdmFormValue_(eu.bcvsolutions.idm.core.eav.entity.IdmFormValue_) RoleRequestEvent(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent) ResolvedIncompatibleRoleDto(eu.bcvsolutions.idm.core.api.dto.ResolvedIncompatibleRoleDto) InputStream(java.io.InputStream) Transactional(org.springframework.transaction.annotation.Transactional) Assert(org.springframework.util.Assert) InvalidFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto) RoleRequestException(eu.bcvsolutions.idm.core.api.exception.RoleRequestException) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) IdmRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter) UUID(java.util.UUID) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)

Example 20 with IdmRoleRequestFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleRequestService method startRequest.

@Override
@Transactional
public IdmRoleRequestDto startRequest(UUID requestId, boolean checkRight) {
    Assert.notNull(requestId, "Role request ID is required!");
    // Load request ... check right for read
    IdmRoleRequestDto request = get(requestId, new IdmRoleRequestFilter(true));
    Assert.notNull(request, "Role request DTO is required!");
    // 
    Map<String, Serializable> variables = new HashMap<>();
    variables.put(RoleRequestApprovalProcessor.CHECK_RIGHT_PROPERTY, checkRight);
    RoleRequestEvent event = new RoleRequestEvent(RoleRequestEventType.EXCECUTE, request, variables);
    // 
    return startRequest(event);
}
Also used : Serializable(java.io.Serializable) HashMap(java.util.HashMap) IdmRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter) RoleRequestEvent(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

IdmRoleRequestFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter)27 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)21 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)19 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)16 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)16 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)15 Test (org.junit.Test)15 Transactional (org.springframework.transaction.annotation.Transactional)15 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)13 IdmRequestIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRequestIdentityRoleDto)11 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)10 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)10 Serializable (java.io.Serializable)8 UUID (java.util.UUID)8 RoleRequestState (eu.bcvsolutions.idm.core.api.domain.RoleRequestState)6 IdmIdentityRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter)6 IdmIdentityRoleService (eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService)5 IdmRoleRequestService (eu.bcvsolutions.idm.core.api.service.IdmRoleRequestService)5 PersistentType (eu.bcvsolutions.idm.core.eav.api.domain.PersistentType)5 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)5