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;
}
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);
}
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();
}
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);
}
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);
}
Aggregations