Search in sources :

Example 1 with IdmIdentityFilter

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

the class IdmIdentityController method toFilter.

@Override
protected IdmIdentityFilter toFilter(MultiValueMap<String, Object> parameters) {
    IdmIdentityFilter filter = new IdmIdentityFilter(parameters);
    filter.setDisabled(getParameterConverter().toBoolean(parameters, IdmIdentityFilter.PARAMETER_DISABLED));
    filter.setSubordinatesFor(getParameterConverter().toEntityUuid(parameters, IdmIdentityFilter.PARAMETER_SUBORDINATES_FOR, IdmIdentity.class));
    filter.setSubordinatesByTreeType(getParameterConverter().toEntityUuid(parameters, IdmIdentityFilter.PARAMETER_SUBORDINATES_BY_TREE_TYPE, IdmTreeType.class));
    filter.setManagersFor(getParameterConverter().toEntityUuid(parameters, IdmIdentityFilter.PARAMETER_MANAGERS_FOR, IdmIdentity.class));
    filter.setManagersByTreeType(getParameterConverter().toEntityUuid(parameters, IdmIdentityFilter.PARAMETER_MANAGERS_BY_TREE_TYPE, IdmTreeType.class));
    filter.setTreeNode(getParameterConverter().toEntityUuid(parameters, "treeNodeId", IdmTreeNode.class));
    filter.setRecursively(getParameterConverter().toBoolean(parameters, "recursively", true));
    filter.setTreeType(getParameterConverter().toUuid(parameters, "treeTypeId"));
    filter.setManagersByContract(getParameterConverter().toUuid(parameters, IdmIdentityFilter.PARAMETER_MANAGERS_BY_CONTRACT));
    filter.setIncludeGuarantees(getParameterConverter().toBoolean(parameters, "includeGuarantees", false));
    // TODO: or / and in multivalues? OR is supported now
    if (parameters.containsKey("role")) {
        for (Object role : parameters.get("role")) {
            filter.getRoles().add(getParameterConverter().toEntityUuid((String) role, IdmRole.class));
        }
    }
    filter.setFirstName(getParameterConverter().toString(parameters, "firstName"));
    filter.setLastName(getParameterConverter().toString(parameters, "lastName"));
    filter.setState(getParameterConverter().toEnum(parameters, IdmIdentityFilter.PARAMETER_STATE, IdentityState.class));
    return filter;
}
Also used : IdmTreeNode(eu.bcvsolutions.idm.core.model.entity.IdmTreeNode) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmRole(eu.bcvsolutions.idm.core.model.entity.IdmRole) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) IdmTreeType(eu.bcvsolutions.idm.core.model.entity.IdmTreeType) IdentityState(eu.bcvsolutions.idm.core.api.domain.IdentityState)

Example 2 with IdmIdentityFilter

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

the class NotifyIdentityTaskExecutor method getItemsToProcess.

@Override
public Page<IdmIdentityDto> getItemsToProcess(Pageable pageable) {
    IdmIdentityFilter filter = new IdmIdentityFilter();
    filter.setText(text);
    // 
    return identityService.find(filter, pageable);
}
Also used : IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter)

Example 3 with IdmIdentityFilter

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

the class AbstractIdentityContractProvisioningProcessor method findAllSubordinates.

/**
 * Returns all identity's subordinates
 *
 * @param identityId
 * @return
 */
protected List<IdmIdentityDto> findAllSubordinates(UUID identityId) {
    if (identityId == null) {
        // just for sure - processor can be wrong configured (e.g. has to have order after identity is saved)
        return new ArrayList<>();
    }
    IdmIdentityFilter filter = new IdmIdentityFilter();
    filter.setSubordinatesFor(identityId);
    return identityService.find(filter, null).getContent();
}
Also used : ArrayList(java.util.ArrayList) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter)

Example 4 with IdmIdentityFilter

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

the class IdentitySyncTest method updateIdentityPropagateValidityTest.

@Test
public void updateIdentityPropagateValidityTest() {
    SysSystemDto system = initData();
    Assert.assertNotNull(system);
    SysSyncIdentityConfigDto config = doCreateSyncConfig(system);
    IdmRoleDto defaultRole = helper.createRole();
    // Set default role to sync configuration
    config.setDefaultRole(defaultRole.getId());
    config = (SysSyncIdentityConfigDto) syncConfigService.save(config);
    IdmIdentityDto identityOne = helper.createIdentity(IDENTITY_ONE);
    IdmIdentityContractDto primeContract = contractService.getPrimeContract(identityOne.getId());
    Assert.assertNotNull(primeContract);
    LocalDate validTill = LocalDate.now().plusDays(10);
    LocalDate validFrom = LocalDate.now().plusDays(-10);
    primeContract.setValidFrom(validFrom);
    primeContract.setValidTill(validTill);
    primeContract = contractService.save(primeContract);
    IdmIdentityFilter identityFilter = new IdmIdentityFilter();
    identityFilter.setUsername(IDENTITY_ONE);
    synchornizationService.setSynchronizationConfigId(config.getId());
    synchornizationService.process();
    SysSyncLogDto log = checkSyncLog(config, SynchronizationActionType.LINK, 1, OperationResultType.SUCCESS);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    List<IdmIdentityRoleDto> roles = identityRoleService.findAllByIdentity(identityOne.getId());
    Assert.assertEquals(1, roles.size());
    IdmIdentityRoleDto identityRole = roles.get(0);
    Assert.assertEquals(defaultRole.getId(), identityRole.getRole());
    Assert.assertEquals(identityRole.getValidFrom(), validFrom);
    Assert.assertEquals(identityRole.getValidTill(), validTill);
    AccIdentityAccountFilter identityAccountFilter = new AccIdentityAccountFilter();
    identityAccountFilter.setIdentityRoleId(identityRole.getId());
    Assert.assertEquals(1, identityAccountService.find(identityAccountFilter, null).getContent().size());
    // Delete log
    syncLogService.delete(log);
}
Also used : SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) LocalDate(org.joda.time.LocalDate) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) DefaultSynchronizationServiceTest(eu.bcvsolutions.idm.acc.service.impl.DefaultSynchronizationServiceTest)

Example 5 with IdmIdentityFilter

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

the class IdentitySyncTest method updateIdentityWithDefaultRoleTest.

@Test
public void updateIdentityWithDefaultRoleTest() {
    SysSystemDto system = initData();
    Assert.assertNotNull(system);
    SysSyncIdentityConfigDto config = doCreateSyncConfig(system);
    IdmRoleDto defaultRole = helper.createRole();
    // Set default role to sync configuration
    config.setDefaultRole(defaultRole.getId());
    config = (SysSyncIdentityConfigDto) syncConfigService.save(config);
    IdmIdentityDto identityOne = helper.createIdentity(IDENTITY_ONE);
    IdmIdentityFilter identityFilter = new IdmIdentityFilter();
    identityFilter.setUsername(IDENTITY_ONE);
    synchornizationService.setSynchronizationConfigId(config.getId());
    synchornizationService.process();
    SysSyncLogDto log = checkSyncLog(config, SynchronizationActionType.LINK, 1, OperationResultType.SUCCESS);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    List<IdmIdentityRoleDto> roles = identityRoleService.findAllByIdentity(identityOne.getId());
    Assert.assertEquals(1, roles.size());
    Assert.assertEquals(defaultRole.getId(), roles.get(0).getRole());
    // Delete log
    syncLogService.delete(log);
}
Also used : SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) DefaultSynchronizationServiceTest(eu.bcvsolutions.idm.acc.service.impl.DefaultSynchronizationServiceTest)

Aggregations

IdmIdentityFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter)39 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)31 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)26 Test (org.junit.Test)26 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)9 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)8 UUID (java.util.UUID)7 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)6 SysSyncIdentityConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto)5 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)5 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)5 DefaultSynchronizationServiceTest (eu.bcvsolutions.idm.acc.service.impl.DefaultSynchronizationServiceTest)5 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)5 IdmIdentity (eu.bcvsolutions.idm.core.model.entity.IdmIdentity)5 PageRequest (org.springframework.data.domain.PageRequest)5 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)4 Sort (org.springframework.data.domain.Sort)3 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)2 IdmScriptAuthorityDto (eu.bcvsolutions.idm.core.api.dto.IdmScriptAuthorityDto)2 IdmScriptDto (eu.bcvsolutions.idm.core.api.dto.IdmScriptDto)2