Search in sources :

Example 1 with WorkbasketAccessItemImpl

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;
}
Also used : WorkbasketAccessItemImpl(pro.taskana.impl.WorkbasketAccessItemImpl)

Example 2 with WorkbasketAccessItemImpl

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
    }
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) InvalidArgumentException(pro.taskana.exceptions.InvalidArgumentException) WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem) WorkbasketAccessItemImpl(pro.taskana.impl.WorkbasketAccessItemImpl) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Aggregations

WorkbasketAccessItemImpl (pro.taskana.impl.WorkbasketAccessItemImpl)2 AbstractAccTest (acceptance.AbstractAccTest)1 Test (org.junit.Test)1 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)1 WorkbasketService (pro.taskana.WorkbasketService)1 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)1 WithAccessId (pro.taskana.security.WithAccessId)1