Search in sources :

Example 1 with WorkbasketAccessItem

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

the class TaskServiceImplIntAutocommitTest 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);
}
Also used : WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem)

Example 2 with WorkbasketAccessItem

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

the class WorkbasketServiceImplIntAutocommitTest method testInsertWorkbasketAccessUser.

@WithAccessId(userName = "Elena", groupNames = { "businessadmin" })
@Test
public void testInsertWorkbasketAccessUser() throws NotAuthorizedException, InvalidArgumentException {
    WorkbasketAccessItem accessItem = workBasketService.newWorkbasketAccessItem("k100000000000000000000000000000000000000", "Arthur Dent");
    accessItem.setPermOpen(true);
    accessItem.setPermRead(true);
    workBasketService.createWorkbasketAccessItem(accessItem);
    Assert.assertEquals(1, workBasketService.getWorkbasketAccessItems("k100000000000000000000000000000000000000").size());
}
Also used : WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 3 with WorkbasketAccessItem

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

the class WorkbasketServiceImplIntAutocommitTest 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);
}
Also used : WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem)

Example 4 with WorkbasketAccessItem

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

the class TaskServiceImplIntExplicitTest method testCreateTask.

@WithAccessId(userName = "Elena", groupNames = { "businessadmin" })
@Test
public void testCreateTask() throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {
    Connection connection = dataSource.getConnection();
    taskanaEngineImpl.setConnection(connection);
    generateSampleAccessItems();
    Task task = this.generateDummyTask();
    connection.commit();
    WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem("wb", "Elena");
    accessItem.setPermAppend(true);
    accessItem.setPermRead(true);
    accessItem.setPermOpen(true);
    workbasketService.createWorkbasketAccessItem(accessItem);
    task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
    task = taskServiceImpl.createTask(task);
    // needed so that the change is visible in the other session
    connection.commit();
    TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
    TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
    Task resultTask = taskServiceImpl2.getTask(task.getId());
    Assert.assertNotNull(resultTask);
    connection.commit();
}
Also used : Task(pro.taskana.Task) TaskanaEngine(pro.taskana.TaskanaEngine) WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem) Connection(java.sql.Connection) TaskServiceImpl(pro.taskana.impl.TaskServiceImpl) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 5 with WorkbasketAccessItem

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

the class TaskServiceImplIntExplicitTest 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);
}
Also used : WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem)

Aggregations

WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)31 Test (org.junit.Test)18 WithAccessId (pro.taskana.security.WithAccessId)16 AbstractAccTest (acceptance.AbstractAccTest)11 WorkbasketService (pro.taskana.WorkbasketService)11 ArrayList (java.util.ArrayList)6 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)6 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)5 WorkbasketAccessItemResource (pro.taskana.rest.resource.WorkbasketAccessItemResource)5 Task (pro.taskana.Task)4 Connection (java.sql.Connection)3 KeyDomain (pro.taskana.KeyDomain)3 TaskService (pro.taskana.TaskService)3 TaskSummary (pro.taskana.TaskSummary)3 InvalidWorkbasketException (pro.taskana.exceptions.InvalidWorkbasketException)3 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)3 NotAuthorizedToQueryWorkbasketException (pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException)3 WorkbasketNotFoundException (pro.taskana.exceptions.WorkbasketNotFoundException)3 WorkbasketAccessItemImpl (pro.taskana.impl.WorkbasketAccessItemImpl)3 SQLException (java.sql.SQLException)2