Search in sources :

Example 41 with WorkbasketService

use of pro.taskana.WorkbasketService in project taskana by Taskana.

the class QueryWorkbasketByPermissionAccTest method testQueryAllTransferTargetsForUserAndGroupFromSubject.

@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test
public void testQueryAllTransferTargetsForUserAndGroupFromSubject() throws SQLException, NotAuthorizedException, SystemException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().callerHasPermission(WorkbasketPermission.APPEND).list();
    Assert.assertEquals(6, results.size());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 42 with WorkbasketService

use of pro.taskana.WorkbasketService in project taskana by Taskana.

the class QueryWorkbasketByPermissionAccTest method testQueryAllTransferTargetsForUser.

@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testQueryAllTransferTargetsForUser() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1").list();
    Assert.assertEquals(1, results.size());
    Assert.assertEquals("USER_1_1", results.get(0).getKey());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 43 with WorkbasketService

use of pro.taskana.WorkbasketService in project taskana by Taskana.

the class UpdateWorkbasketAccTest method testUpdateWorkbasket.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "businessadmin" })
@Test
public void testUpdateWorkbasket() throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, InvalidWorkbasketException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A");
    Instant modified = workbasket.getModified();
    workbasket.setName("new name");
    workbasket.setDescription("new description");
    workbasket.setType(WorkbasketType.TOPIC);
    workbasket.setOrgLevel1("new level 1");
    workbasket.setOrgLevel2("new level 2");
    workbasket.setOrgLevel3("new level 3");
    workbasket.setOrgLevel4("new level 4");
    workbasket.setCustom1("new custom 1");
    workbasket.setCustom2("new custom 2");
    workbasket.setCustom3("new custom 3");
    workbasket.setCustom4("new custom 4");
    workbasket.setDescription("new description");
    workbasketService.updateWorkbasket(workbasket);
    Workbasket updatedWorkbasket = workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A");
    Assert.assertEquals(workbasket.getId(), updatedWorkbasket.getId());
    Assert.assertEquals(workbasket.getCreated(), updatedWorkbasket.getCreated());
    Assert.assertNotEquals(modified, updatedWorkbasket.getModified());
    Assert.assertEquals("new name", updatedWorkbasket.getName());
    Assert.assertEquals(WorkbasketType.TOPIC, updatedWorkbasket.getType());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) Instant(java.time.Instant) Workbasket(pro.taskana.Workbasket) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 44 with WorkbasketService

use of pro.taskana.WorkbasketService in project taskana by Taskana.

the class UpdateWorkbasketAccTest method testCheckAuthorizationToUpdateWorkbasket.

@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test(expected = NotAuthorizedException.class)
public void testCheckAuthorizationToUpdateWorkbasket() throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, InvalidWorkbasketException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    Workbasket workbasket = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A");
    workbasket.setName("new name");
    workbasketService.updateWorkbasket(workbasket);
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) Workbasket(pro.taskana.Workbasket) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 45 with WorkbasketService

use of pro.taskana.WorkbasketService in project taskana by Taskana.

the class QueryWorkbasketByPermissionAccTest method testQueryAllAvailableWorkbasketForOpeningForUserAndGroupFromSubject.

@WithAccessId(userName = "user_1_1")
@Test
public void testQueryAllAvailableWorkbasketForOpeningForUserAndGroupFromSubject() throws SQLException, NotAuthorizedException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().callerHasPermission(WorkbasketPermission.READ).list();
    Assert.assertEquals(1, results.size());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Aggregations

AbstractAccTest (acceptance.AbstractAccTest)84 Test (org.junit.Test)84 WorkbasketService (pro.taskana.WorkbasketService)84 WithAccessId (pro.taskana.security.WithAccessId)78 WorkbasketSummary (pro.taskana.WorkbasketSummary)52 Workbasket (pro.taskana.Workbasket)12 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)11 ArrayList (java.util.ArrayList)8 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)7 InvalidWorkbasketException (pro.taskana.exceptions.InvalidWorkbasketException)5 WorkbasketNotFoundException (pro.taskana.exceptions.WorkbasketNotFoundException)5 SQLException (java.sql.SQLException)4 Task (pro.taskana.Task)4 TaskService (pro.taskana.TaskService)4 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)4 List (java.util.List)3 Assert.assertTrue (org.junit.Assert.assertTrue)3 Assert.fail (org.junit.Assert.fail)3 Ignore (org.junit.Ignore)3 RunWith (org.junit.runner.RunWith)3