use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class NotificationTemplateDeleteBulkActionIntegrationTest method processBulkActionWithoutPermission.
@Test
public void processBulkActionWithoutPermission() {
templateService.init();
IdmNotificationTemplateDto template1 = templateService.getByCode(TEST_TEMPLATE);
IdmNotificationTemplateDto template2 = templateService.getByCode(TEST_TEMPLATE_TWO);
template1.setUnmodifiable(false);
template2.setUnmodifiable(false);
template1 = templateService.save(template1);
template2 = templateService.save(template2);
Set<UUID> templates = new HashSet<UUID>();
templates.add(template1.getId());
templates.add(template2.getId());
// user hasn't permission for update role
IdmIdentityDto readerIdentity = this.createUserWithAuthorities(IdmBasePermission.READ);
loginAsNoAdmin(readerIdentity.getUsername());
IdmBulkActionDto bulkAction = this.findBulkAction(IdmNotificationTemplate.class, NotificationTemplateDeleteBulkAction.NAME);
bulkAction.setIdentifiers(templates);
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 0l, null, null);
for (UUID id : templates) {
IdmNotificationTemplateDto templateDto = templateService.get(id);
assertNotNull(templateDto);
}
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class AuthorizationPolicyDeleteBulkActionIntegrationTest method processBulkActionByFilter.
@Test
public void processBulkActionByFilter() {
List<IdmAuthorizationPolicyDto> policies = createPolicies(5);
IdmAuthorizationPolicyFilter filter = new IdmAuthorizationPolicyFilter();
filter.setId(policies.get(2).getId());
List<IdmAuthorizationPolicyDto> checkPolicies = service.find(filter, null).getContent();
Assert.assertEquals(1, checkPolicies.size());
IdmBulkActionDto bulkAction = findBulkAction(IdmAuthorizationPolicy.class, AuthorizationPolicyDeleteBulkAction.NAME);
bulkAction.setTransformedFilter(filter);
bulkAction.setFilter(toMap(filter));
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 1l, null, null);
Assert.assertNull(service.get(policies.get(2)));
Assert.assertNotNull(service.get(policies.get(1)));
Assert.assertNotNull(service.get(policies.get(3)));
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class AuthorizationPolicyEnableBulkActionIntegrationTest method processBulkActionByIds.
@Test
public void processBulkActionByIds() {
List<IdmAuthorizationPolicyDto> policies = createPolicies(5);
IdmBulkActionDto bulkAction = findBulkAction(IdmAuthorizationPolicy.class, AuthorizationPolicyEnableBulkAction.NAME);
Set<UUID> ids = this.getIdFromList(policies);
for (UUID id : ids) {
Assert.assertTrue(service.get(id).isDisabled());
}
//
bulkAction.setIdentifiers(ids);
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 5l, null, null);
//
for (UUID id : ids) {
Assert.assertFalse(service.get(id).isDisabled());
}
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class AuthorizationPolicyEnableBulkActionIntegrationTest method processBulkActionByFilter.
@Test
public void processBulkActionByFilter() {
List<IdmAuthorizationPolicyDto> policies = createPolicies(5);
IdmAuthorizationPolicyFilter filter = new IdmAuthorizationPolicyFilter();
filter.setId(policies.get(2).getId());
List<IdmAuthorizationPolicyDto> checkPolicies = service.find(filter, null).getContent();
Assert.assertEquals(1, checkPolicies.size());
IdmBulkActionDto bulkAction = findBulkAction(IdmAuthorizationPolicy.class, AuthorizationPolicyEnableBulkAction.NAME);
bulkAction.setTransformedFilter(filter);
bulkAction.setFilter(toMap(filter));
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 1l, null, null);
Assert.assertFalse(service.get(policies.get(2)).isDisabled());
Assert.assertTrue(service.get(policies.get(1)).isDisabled());
Assert.assertTrue(service.get(policies.get(3)).isDisabled());
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class RoleDeleteBulkActionIntegrationTest method processBulkActionByFilter.
@Test
public void processBulkActionByFilter() {
String testDescription = "bulkActionName" + System.currentTimeMillis();
List<IdmRoleDto> roles = this.createRoles(5);
for (IdmRoleDto role : roles) {
role.setDescription(testDescription);
role = roleService.save(role);
}
IdmRoleFilter filter = new IdmRoleFilter();
filter.setValue(testDescription);
filter.setProperty(IdmRole_.description.getName());
List<IdmRoleDto> checkIdentities = roleService.find(filter, null).getContent();
assertEquals(5, checkIdentities.size());
IdmBulkActionDto bulkAction = this.findBulkAction(IdmRole.class, RoleDeleteBulkAction.NAME);
bulkAction.setTransformedFilter(filter);
bulkAction.setFilter(toMap(filter));
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 5l, null, null);
for (IdmRoleDto role : roles) {
IdmRoleDto dto = roleService.get(role.getId());
assertNull(dto);
}
}
Aggregations