TSK-383: removed InvalidArgumentException from WorkbasketQuery.callerHasPermission()

This commit is contained in:
Holger Hagen 2018-03-20 10:14:29 +01:00 committed by Martin Rojas Miguel Angel
parent 4bc7b6bad1
commit ea7ab903d5
3 changed files with 8 additions and 11 deletions

View File

@ -163,17 +163,14 @@ public interface WorkbasketQuery extends BaseQuery<WorkbasketSummary> {
throws InvalidArgumentException, NotAuthorizedException; throws InvalidArgumentException, NotAuthorizedException;
/** /**
* Setting up the permissions for the accessIds of the CurrentUserContext. READ permissions need to be granted,too * Add condition to query if the caller (one of the accessIds of the caller) has the given permission on the
* by default.<br> * workbasket.
* The UserContext-AccessIds and the given permission will throw a Exception if they would be NULL.
* *
* @return the current query object. * @return the updated query.
* @param permission * @param permission
* which should be used for results. * the permission for the query condition.
* @throws InvalidArgumentException
* when permission OR accessIds of the userContext are NULL.
*/ */
WorkbasketQuery callerHasPermission(WorkbasketPermission permission) throws InvalidArgumentException; WorkbasketQuery callerHasPermission(WorkbasketPermission permission);
/** /**
* Sort the query result by name. * Sort the query result by name.

View File

@ -361,7 +361,7 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
} }
@Override @Override
public WorkbasketQuery callerHasPermission(WorkbasketPermission permission) throws InvalidArgumentException { public WorkbasketQuery callerHasPermission(WorkbasketPermission permission) {
this.permission = permission; this.permission = permission;
return this; return this;
} }

View File

@ -127,7 +127,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryAllTransferTargetsForUserAndGroupFromSubject() public void testQueryAllTransferTargetsForUserAndGroupFromSubject()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException { throws SQLException, NotAuthorizedException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.callerHasPermission(WorkbasketPermission.APPEND) .callerHasPermission(WorkbasketPermission.APPEND)
@ -138,7 +138,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
@WithAccessId(userName = "user_1_1") @WithAccessId(userName = "user_1_1")
@Test @Test
public void testQueryAllAvailableWorkbasketForOpeningForUserAndGroupFromSubject() public void testQueryAllAvailableWorkbasketForOpeningForUserAndGroupFromSubject()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws SQLException, NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.callerHasPermission(WorkbasketPermission.READ) .callerHasPermission(WorkbasketPermission.READ)