use of pro.taskana.WorkbasketAccessItem in project taskana by Taskana.
the class WorkbasketServiceImplIntExplicitTest method createWorkbasketWithSecurity.
private void createWorkbasketWithSecurity(Workbasket wb, String accessId, boolean permOpen, boolean permRead, boolean permAppend, boolean permTransfer) throws InvalidArgumentException, NotAuthorizedException {
WorkbasketAccessItem accessItem = workBasketService.newWorkbasketAccessItem(wb.getId(), accessId);
accessItem.setPermOpen(permOpen);
accessItem.setPermRead(permRead);
accessItem.setPermAppend(permAppend);
accessItem.setPermTransfer(permTransfer);
workBasketService.createWorkbasketAccessItem(accessItem);
}
use of pro.taskana.WorkbasketAccessItem in project taskana by Taskana.
the class WorkbasketServiceImplIntExplicitTest method testUpdateWorkbasketAccessUser.
@WithAccessId(userName = "Elena", groupNames = { "businessadmin" })
@Test
public void testUpdateWorkbasketAccessUser() throws NotAuthorizedException, SQLException, InvalidArgumentException {
Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection);
workBasketService = taskanaEngine.getWorkbasketService();
WorkbasketAccessItem accessItem = workBasketService.newWorkbasketAccessItem("key2", "Zaphod Beeblebrox");
accessItem.setPermOpen(true);
accessItem.setPermRead(true);
workBasketService.createWorkbasketAccessItem(accessItem);
Assert.assertEquals(1, workBasketService.getWorkbasketAccessItems("key2").size());
Assert.assertEquals("zaphod beeblebrox", accessItem.getAccessId());
connection.commit();
}
use of pro.taskana.WorkbasketAccessItem in project taskana by Taskana.
the class WorkbasketServiceImplIntAutocommitTest method testUpdateWorkbasketAccessUser.
@WithAccessId(userName = "Elena", groupNames = { "businessadmin" })
@Test
public void testUpdateWorkbasketAccessUser() throws NotAuthorizedException, InvalidArgumentException {
WorkbasketAccessItem accessItem = workBasketService.newWorkbasketAccessItem("k200000000000000000000000000000000000000", "Zaphod Beeblebrox");
accessItem.setPermOpen(true);
accessItem.setPermRead(true);
workBasketService.createWorkbasketAccessItem(accessItem);
Assert.assertEquals(1, workBasketService.getWorkbasketAccessItems("k200000000000000000000000000000000000000").size());
accessItem.setPermAppend(true);
workBasketService.updateWorkbasketAccessItem(accessItem);
if (TaskanaEngineConfiguration.shouldUseLowerCaseForAccessIds()) {
Assert.assertEquals("zaphod beeblebrox", accessItem.getAccessId());
} else {
Assert.assertEquals("Zaphod Beeblebrox", accessItem.getAccessId());
}
}
use of pro.taskana.WorkbasketAccessItem in project taskana by Taskana.
the class UpdateWorkbasketAuthorizationsAccTest method testUpdateWorkbasketAccessItemSucceeds.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "businessadmin" })
@Test
public void testUpdateWorkbasketAccessItemSucceeds() throws InvalidArgumentException, NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem("key1000000000000000000000000000000000000", "user1");
accessItem.setPermAppend(true);
accessItem.setPermCustom11(true);
accessItem.setPermRead(true);
accessItem = workbasketService.createWorkbasketAccessItem(accessItem);
accessItem.setPermCustom1(true);
accessItem.setPermAppend(false);
WorkbasketAccessItem updatedItem = workbasketService.updateWorkbasketAccessItem(accessItem);
Assert.assertEquals(false, updatedItem.isPermAppend());
Assert.assertEquals(true, updatedItem.isPermRead());
Assert.assertEquals(true, updatedItem.isPermCustom11());
Assert.assertEquals(true, updatedItem.isPermCustom1());
Assert.assertEquals(false, updatedItem.isPermCustom2());
}
use of pro.taskana.WorkbasketAccessItem in project taskana by Taskana.
the class UpdateWorkbasketAuthorizationsAccTest method testInsertAccessItemList.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "businessadmin" })
@Test
public void testInsertAccessItemList() throws InvalidArgumentException, NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
final String wbId = "WBI:100000000000000000000000000000000004";
List<WorkbasketAccessItem> accessItems = workbasketService.getWorkbasketAccessItems(wbId);
int countBefore = accessItems.size();
// update some values
WorkbasketAccessItem item0 = accessItems.get(0);
item0.setPermAppend(false);
item0.setPermOpen(false);
item0.setPermTransfer(false);
final String updateId0 = item0.getId();
// insert new entry
WorkbasketAccessItem newItem = workbasketService.newWorkbasketAccessItem(wbId, CurrentUserContext.getUserid());
newItem.setPermRead(true);
newItem.setPermOpen(true);
newItem.setPermCustom12(true);
accessItems.add(newItem);
workbasketService.setWorkbasketAccessItems(wbId, accessItems);
List<WorkbasketAccessItem> updatedAccessItems = workbasketService.getWorkbasketAccessItems(wbId);
int countAfter = updatedAccessItems.size();
assertTrue((countBefore + 1) == countAfter);
item0 = updatedAccessItems.stream().filter(i -> i.getId().equals(updateId0)).findFirst().get();
assertFalse(item0.isPermAppend());
assertFalse(item0.isPermOpen());
assertFalse(item0.isPermTransfer());
assertFalse(item0.isPermAppend());
assertFalse(item0.isPermTransfer());
}
Aggregations