use of pro.taskana.impl.WorkbasketAccessItemImpl in project taskana by Taskana.
the class WorkbasketAccessItemMapper method toModel.
public WorkbasketAccessItem toModel(WorkbasketAccessItemResource wbAccItemRecource) {
WorkbasketAccessItemImpl wbAccItemModel = (WorkbasketAccessItemImpl) workbasketService.newWorkbasketAccessItem(wbAccItemRecource.workbasketId, wbAccItemRecource.accessId);
BeanUtils.copyProperties(wbAccItemRecource, wbAccItemModel);
wbAccItemModel.setId(wbAccItemRecource.accessItemId);
return wbAccItemModel;
}
use of pro.taskana.impl.WorkbasketAccessItemImpl in project taskana by Taskana.
the class UpdateWorkbasketAuthorizationsAccTest method testUpdateWorkbasketAccessItemRejected.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "businessadmin" })
@Test
public void testUpdateWorkbasketAccessItemRejected() throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, InvalidWorkbasketException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem("1000000000000000000000000000000000000000", "user1");
accessItem.setPermAppend(true);
accessItem.setPermCustom11(true);
accessItem.setPermRead(true);
accessItem = workbasketService.createWorkbasketAccessItem(accessItem);
accessItem.setPermCustom1(true);
accessItem.setPermAppend(false);
((WorkbasketAccessItemImpl) accessItem).setAccessId("willi");
try {
workbasketService.updateWorkbasketAccessItem(accessItem);
fail("InvalidArgumentException was expected because access id was changed");
} catch (InvalidArgumentException ex) {
// nothing to do
}
((WorkbasketAccessItemImpl) accessItem).setAccessId("user1");
accessItem = workbasketService.updateWorkbasketAccessItem(accessItem);
Assert.assertEquals(false, accessItem.isPermAppend());
Assert.assertEquals(true, accessItem.isPermRead());
Assert.assertEquals(true, accessItem.isPermCustom11());
Assert.assertEquals(true, accessItem.isPermCustom1());
Assert.assertEquals(false, accessItem.isPermCustom2());
((WorkbasketAccessItemImpl) accessItem).setWorkbasketId("2");
try {
workbasketService.updateWorkbasketAccessItem(accessItem);
fail("InvalidArgumentException was expected because key was changed");
} catch (InvalidArgumentException ex) {
// nothing to do
}
}
Aggregations