TSK-2012: renamed Mismatched_Exceptions to NotAuthorizedExceptions

This commit is contained in:
Holger Hagen 2023-03-02 15:57:18 +01:00 committed by Mustapha Zorgati
parent ac95f8b181
commit d21eb47ffe
123 changed files with 786 additions and 808 deletions

View File

@ -9,13 +9,13 @@ import pro.taskana.common.internal.util.MapCreator;
* This exception is thrown when the current user is not in a certain {@linkplain TaskanaRole role} * This exception is thrown when the current user is not in a certain {@linkplain TaskanaRole role}
* it is supposed to be. * it is supposed to be.
*/ */
public class MismatchedRoleException extends TaskanaException { public class NotAuthorizedException extends TaskanaException {
public static final String ERROR_KEY = "ROLE_MISMATCHED"; public static final String ERROR_KEY = "NOT_AUTHORIZED";
private final String currentUserId; private final String currentUserId;
private final TaskanaRole[] roles; private final TaskanaRole[] roles;
public MismatchedRoleException(String currentUserId, TaskanaRole... roles) { public NotAuthorizedException(String currentUserId, TaskanaRole... roles) {
super( super(
String.format( String.format(
"Not authorized. The current user '%s' is not member of role(s) '%s'.", "Not authorized. The current user '%s' is not member of role(s) '%s'.",

View File

@ -1,7 +1,7 @@
package pro.taskana.simplehistory; package pro.taskana.simplehistory;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.spi.history.api.TaskanaHistory; import pro.taskana.spi.history.api.TaskanaHistory;
/** The TaskanaHistoryEngine represents an overall set of all needed services. */ /** The TaskanaHistoryEngine represents an overall set of all needed services. */
@ -25,7 +25,7 @@ public interface TaskanaHistoryEngine {
* Checks whether current user is member of any of the specified roles. * Checks whether current user is member of any of the specified roles.
* *
* @param roles The roles that are checked for membership of the current user * @param roles The roles that are checked for membership of the current user
* @throws MismatchedRoleException If the current user is not member of any specified role * @throws NotAuthorizedException If the current user is not member of any specified role
*/ */
void checkRoleMembership(TaskanaRole... roles) throws MismatchedRoleException; void checkRoleMembership(TaskanaRole... roles) throws NotAuthorizedException;
} }

View File

@ -9,7 +9,7 @@ import org.slf4j.LoggerFactory;
import pro.taskana.common.api.TaskanaEngine; import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryEventMapper; import pro.taskana.simplehistory.impl.classification.ClassificationHistoryEventMapper;
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryQuery; import pro.taskana.simplehistory.impl.classification.ClassificationHistoryQuery;
import pro.taskana.simplehistory.impl.task.TaskHistoryEventMapper; import pro.taskana.simplehistory.impl.task.TaskHistoryEventMapper;
@ -103,7 +103,7 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
@Override @Override
public void deleteHistoryEventsByTaskIds(List<String> taskIds) public void deleteHistoryEventsByTaskIds(List<String> taskIds)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
taskanaHistoryEngine.checkRoleMembership(TaskanaRole.ADMIN); taskanaHistoryEngine.checkRoleMembership(TaskanaRole.ADMIN);
if (taskIds == null) { if (taskIds == null) {

View File

@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
import pro.taskana.TaskanaConfiguration; import pro.taskana.TaskanaConfiguration;
import pro.taskana.common.api.TaskanaEngine; import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.internal.OracleSqlSessionFactory; import pro.taskana.common.internal.OracleSqlSessionFactory;
import pro.taskana.common.internal.configuration.DB; import pro.taskana.common.internal.configuration.DB;
@ -89,7 +89,7 @@ public class TaskanaHistoryEngineImpl implements TaskanaHistoryEngine {
.anyMatch(rolesMembers::contains); .anyMatch(rolesMembers::contains);
} }
public void checkRoleMembership(TaskanaRole... roles) throws MismatchedRoleException { public void checkRoleMembership(TaskanaRole... roles) throws NotAuthorizedException {
if (!isUserInRole(roles)) { if (!isUserInRole(roles)) {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug( LOGGER.debug(
@ -97,7 +97,7 @@ public class TaskanaHistoryEngineImpl implements TaskanaHistoryEngine {
taskanaEngine.getCurrentUserContext().getAccessIds(), taskanaEngine.getCurrentUserContext().getAccessIds(),
Arrays.toString(roles)); Arrays.toString(roles));
} }
throw new MismatchedRoleException(taskanaEngine.getCurrentUserContext().getUserid(), roles); throw new NotAuthorizedException(taskanaEngine.getCurrentUserContext().getUserid(), roles);
} }
} }

View File

@ -19,7 +19,7 @@ import pro.taskana.common.api.ScheduledJob;
import pro.taskana.common.api.TaskanaEngine; import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.api.TimeInterval; import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.internal.jobs.AbstractTaskanaJob; import pro.taskana.common.internal.jobs.AbstractTaskanaJob;
import pro.taskana.common.internal.transaction.TaskanaTransactionProvider; import pro.taskana.common.internal.transaction.TaskanaTransactionProvider;
@ -181,7 +181,7 @@ public class HistoryCleanupJob extends AbstractTaskanaJob {
} }
private int deleteEvents(List<String> taskIdsToDeleteHistoryEventsFor) private int deleteEvents(List<String> taskIdsToDeleteHistoryEventsFor)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
SimpleHistoryServiceImpl simpleHistoryService = SimpleHistoryServiceImpl simpleHistoryService =
(SimpleHistoryServiceImpl) taskanaHistoryEngine.getTaskanaHistoryService(); (SimpleHistoryServiceImpl) taskanaHistoryEngine.getTaskanaHistoryService();

View File

@ -16,7 +16,7 @@ import pro.taskana.task.api.exceptions.TaskAlreadyExistException;
import pro.taskana.task.api.exceptions.TaskNotFoundException; import pro.taskana.task.api.exceptions.TaskNotFoundException;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.task.internal.models.ObjectReferenceImpl; import pro.taskana.task.internal.models.ObjectReferenceImpl;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
/** Example Bootstrap Application. */ /** Example Bootstrap Application. */
@ -30,7 +30,7 @@ public class ExampleBootstrap {
throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException,
InvalidOwnerException, TaskAlreadyExistException, InvalidArgumentException, InvalidOwnerException, TaskAlreadyExistException, InvalidArgumentException,
AttachmentPersistenceException, ObjectReferencePersistenceException, AttachmentPersistenceException, ObjectReferencePersistenceException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException { NotAuthorizedOnWorkbasketException, InvalidTaskStateException {
System.out.println("---------------------------> Start App"); System.out.println("---------------------------> Start App");
ObjectReferenceImpl objRef = new ObjectReferenceImpl(); ObjectReferenceImpl objRef = new ObjectReferenceImpl();
objRef.setCompany("aCompany"); objRef.setCompany("aCompany");

View File

@ -28,7 +28,7 @@ import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.TimeInterval; import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.DomainNotFoundException; import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.util.Pair; import pro.taskana.common.internal.util.Pair;
import pro.taskana.testapi.DefaultTestEntities; import pro.taskana.testapi.DefaultTestEntities;
import pro.taskana.testapi.TaskanaInject; import pro.taskana.testapi.TaskanaInject;
@ -263,11 +263,11 @@ class CreateClassificationAccTest {
void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin(WithAccessId accessId) { void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin(WithAccessId accessId) {
Classification classification = Classification classification =
classificationService.newClassification("KeyErrCreation", MASTER_DOMAIN, "TASK"); classificationService.newClassification("KeyErrCreation", MASTER_DOMAIN, "TASK");
MismatchedRoleException expectedException = NotAuthorizedException expectedException =
new MismatchedRoleException(accessId.user(), TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); new NotAuthorizedException(accessId.user(), TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
assertThatThrownBy(() -> classificationService.createClassification(classification)) assertThatThrownBy(() -> classificationService.createClassification(classification))
.isInstanceOf(MismatchedRoleException.class) .isInstanceOf(NotAuthorizedException.class)
.usingRecursiveComparison() .usingRecursiveComparison()
.isEqualTo(expectedException); .isEqualTo(expectedException);
} }

View File

@ -13,7 +13,7 @@ import pro.taskana.classification.api.exceptions.ClassificationInUseException;
import pro.taskana.classification.api.exceptions.ClassificationNotFoundException; import pro.taskana.classification.api.exceptions.ClassificationNotFoundException;
import pro.taskana.classification.api.models.Classification; import pro.taskana.classification.api.models.Classification;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.task.api.TaskService; import pro.taskana.task.api.TaskService;
import pro.taskana.task.api.models.Attachment; import pro.taskana.task.api.models.Attachment;
import pro.taskana.testapi.DefaultTestEntities; import pro.taskana.testapi.DefaultTestEntities;
@ -79,7 +79,7 @@ class DeleteClassificationAccTest {
classificationService.deleteClassification( classificationService.deleteClassification(
classification.getKey(), classification.getDomain()); classification.getKey(), classification.getDomain());
MismatchedRoleException e = catchThrowableOfType(call, MismatchedRoleException.class); NotAuthorizedException e = catchThrowableOfType(call, NotAuthorizedException.class);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1"); assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e.getRoles()) assertThat(e.getRoles())
.containsExactlyInAnyOrder(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); .containsExactlyInAnyOrder(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
@ -95,7 +95,7 @@ class DeleteClassificationAccTest {
ThrowingCallable call = ThrowingCallable call =
() -> classificationService.deleteClassification(classification.getId()); () -> classificationService.deleteClassification(classification.getId());
MismatchedRoleException e = catchThrowableOfType(call, MismatchedRoleException.class); NotAuthorizedException e = catchThrowableOfType(call, NotAuthorizedException.class);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1"); assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e.getRoles()) assertThat(e.getRoles())
.containsExactlyInAnyOrder(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); .containsExactlyInAnyOrder(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);

View File

@ -37,7 +37,7 @@ import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.WorkingTimeCalculator; import pro.taskana.common.api.WorkingTimeCalculator;
import pro.taskana.common.api.exceptions.ConcurrencyException; import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.security.CurrentUserContext; import pro.taskana.common.api.security.CurrentUserContext;
import pro.taskana.common.internal.jobs.JobRunner; import pro.taskana.common.internal.jobs.JobRunner;
import pro.taskana.common.internal.util.Pair; import pro.taskana.common.internal.util.Pair;
@ -654,8 +654,8 @@ class UpdateClassificationAccTest {
classificationService.getClassification("BeforeAllClassification", "DOMAIN_A"); classificationService.getClassification("BeforeAllClassification", "DOMAIN_A");
classification.setCustomField(ClassificationCustomField.CUSTOM_1, "newCustom1"); classification.setCustomField(ClassificationCustomField.CUSTOM_1, "newCustom1");
MismatchedRoleException expectedException = NotAuthorizedException expectedException =
new MismatchedRoleException( new NotAuthorizedException(
currentUserContext.getUserid(), TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); currentUserContext.getUserid(), TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
assertThatThrownBy(() -> classificationService.updateClassification(classification)) assertThatThrownBy(() -> classificationService.updateClassification(classification))
.usingRecursiveComparison() .usingRecursiveComparison()
@ -672,8 +672,8 @@ class UpdateClassificationAccTest {
classification.setApplicationEntryPoint("updated EntryPoint"); classification.setApplicationEntryPoint("updated EntryPoint");
classification.setName("updated Name"); classification.setName("updated Name");
MismatchedRoleException expectedException = NotAuthorizedException expectedException =
new MismatchedRoleException( new NotAuthorizedException(
currentUserContext.getUserid(), TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); currentUserContext.getUserid(), TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
assertThatThrownBy(() -> classificationService.updateClassification(classification)) assertThatThrownBy(() -> classificationService.updateClassification(classification))
.usingRecursiveComparison() .usingRecursiveComparison()

View File

@ -43,7 +43,7 @@ import pro.taskana.testapi.security.WithAccessId;
import pro.taskana.user.api.UserService; import pro.taskana.user.api.UserService;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.api.models.WorkbasketSummary;
@TaskanaIntegrationTest @TaskanaIntegrationTest
@ -213,8 +213,8 @@ class CompleteTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.completeTask(claimedTask.getId()); ThrowingCallable call = () -> taskService.completeTask(claimedTask.getId());
MismatchedWorkbasketPermissionException e = NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, MismatchedWorkbasketPermissionException.class); catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
assertThat(e.getCurrentUserId()).isEqualTo(currentUserContext.getUserid()); assertThat(e.getCurrentUserId()).isEqualTo(currentUserContext.getUserid());
WorkbasketSummary workbasket = claimedTask.getWorkbasketSummary(); WorkbasketSummary workbasket = claimedTask.getWorkbasketSummary();
assertThat(e.getWorkbasketId()).isEqualTo(workbasket.getId()); assertThat(e.getWorkbasketId()).isEqualTo(workbasket.getId());

View File

@ -33,7 +33,7 @@ import pro.taskana.testapi.builder.WorkbasketAccessItemBuilder;
import pro.taskana.testapi.security.WithAccessId; import pro.taskana.testapi.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.api.models.WorkbasketSummary;
@TaskanaIntegrationTest @TaskanaIntegrationTest
@ -142,8 +142,8 @@ class RequestChangesAccTest {
Task task = createTaskInReviewByUser("user-1-1").buildAndStore(taskService, "user-1-1"); Task task = createTaskInReviewByUser("user-1-1").buildAndStore(taskService, "user-1-1");
ThrowingCallable call = () -> taskService.requestChanges(task.getId()); ThrowingCallable call = () -> taskService.requestChanges(task.getId());
MismatchedWorkbasketPermissionException e = NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, MismatchedWorkbasketPermissionException.class); catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ); assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2"); assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId()); assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());

View File

@ -33,7 +33,7 @@ import pro.taskana.testapi.builder.WorkbasketAccessItemBuilder;
import pro.taskana.testapi.security.WithAccessId; import pro.taskana.testapi.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.api.models.WorkbasketSummary;
@TaskanaIntegrationTest @TaskanaIntegrationTest
@ -171,8 +171,8 @@ class RequestReviewAccTest {
Task task = createTaskClaimedByUser("user-1-1").buildAndStore(taskService, "user-1-1"); Task task = createTaskClaimedByUser("user-1-1").buildAndStore(taskService, "user-1-1");
ThrowingCallable call = () -> taskService.requestReview(task.getId()); ThrowingCallable call = () -> taskService.requestReview(task.getId());
MismatchedWorkbasketPermissionException e = NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, MismatchedWorkbasketPermissionException.class); catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ); assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2"); assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId()); assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());

View File

@ -24,7 +24,7 @@ import pro.taskana.testapi.builder.WorkbasketAccessItemBuilder;
import pro.taskana.testapi.security.WithAccessId; import pro.taskana.testapi.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.models.Workbasket; import pro.taskana.workbasket.api.models.Workbasket;
@TaskanaIntegrationTest @TaskanaIntegrationTest
@ -101,8 +101,8 @@ class CreateTaskCommentAccTest {
ThrowingCallable call = () -> taskService.createTaskComment(taskCommentToCreate); ThrowingCallable call = () -> taskService.createTaskComment(taskCommentToCreate);
MismatchedWorkbasketPermissionException e = NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, MismatchedWorkbasketPermissionException.class); catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2"); assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasket.getId()); assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasket.getId());
assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ); assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ);

View File

@ -33,7 +33,7 @@ import pro.taskana.user.api.UserService;
import pro.taskana.user.api.models.User; import pro.taskana.user.api.models.User;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.models.Workbasket; import pro.taskana.workbasket.api.models.Workbasket;
@TaskanaIntegrationTest @TaskanaIntegrationTest
@ -131,8 +131,8 @@ class GetTaskCommentAccTest {
@Test @Test
void should_FailToReturnTaskComments_When_TaskIsNotVisible() { void should_FailToReturnTaskComments_When_TaskIsNotVisible() {
ThrowingCallable call = () -> taskService.getTaskComments(task1.getId()); ThrowingCallable call = () -> taskService.getTaskComments(task1.getId());
MismatchedWorkbasketPermissionException e = NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, MismatchedWorkbasketPermissionException.class); catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2"); assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ); assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ);
@ -151,8 +151,8 @@ class GetTaskCommentAccTest {
.buildAndStore(taskService, "user-1-1"); .buildAndStore(taskService, "user-1-1");
ThrowingCallable call = () -> taskService.getTaskComment(comment.getId()); ThrowingCallable call = () -> taskService.getTaskComment(comment.getId());
MismatchedWorkbasketPermissionException e = NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, MismatchedWorkbasketPermissionException.class); catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2"); assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ); assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ);

View File

@ -15,7 +15,7 @@ import pro.taskana.classification.api.ClassificationService;
import pro.taskana.classification.api.models.ClassificationSummary; import pro.taskana.classification.api.models.ClassificationSummary;
import pro.taskana.common.api.exceptions.ConcurrencyException; import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.task.api.TaskService; import pro.taskana.task.api.TaskService;
import pro.taskana.task.api.exceptions.MismatchedTaskCommentCreatorException; import pro.taskana.task.api.exceptions.NotAuthorizedOnTaskCommentException;
import pro.taskana.task.api.models.ObjectReference; import pro.taskana.task.api.models.ObjectReference;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.task.api.models.TaskComment; import pro.taskana.task.api.models.TaskComment;
@ -28,7 +28,7 @@ import pro.taskana.testapi.builder.WorkbasketAccessItemBuilder;
import pro.taskana.testapi.security.WithAccessId; import pro.taskana.testapi.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.api.models.WorkbasketSummary;
@TaskanaIntegrationTest @TaskanaIntegrationTest
@ -90,7 +90,7 @@ class UpdateTaskCommentAccTest {
taskComment.setTextField("updated textfield"); taskComment.setTextField("updated textfield");
assertThatThrownBy(() -> taskService.updateTaskComment(taskComment)) assertThatThrownBy(() -> taskService.updateTaskComment(taskComment))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")
@ -108,7 +108,7 @@ class UpdateTaskCommentAccTest {
ThrowingCallable updateTaskCommentCall = () -> taskService.updateTaskComment(taskComment); ThrowingCallable updateTaskCommentCall = () -> taskService.updateTaskComment(taskComment);
assertThatThrownBy(updateTaskCommentCall) assertThatThrownBy(updateTaskCommentCall)
.isInstanceOf(MismatchedTaskCommentCreatorException.class); .isInstanceOf(NotAuthorizedOnTaskCommentException.class);
} }
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")

View File

@ -30,7 +30,7 @@ import pro.taskana.TaskanaConfiguration;
import pro.taskana.common.api.TaskanaEngine; import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.util.Triplet; import pro.taskana.common.internal.util.Triplet;
import pro.taskana.testapi.TaskanaConfigurationModifier; import pro.taskana.testapi.TaskanaConfigurationModifier;
import pro.taskana.testapi.TaskanaInject; import pro.taskana.testapi.TaskanaInject;
@ -471,7 +471,7 @@ class UserServiceAccTest {
userToCreate.setLastName("lastName"); userToCreate.setLastName("lastName");
ThrowingCallable callable = () -> userService.createUser(userToCreate); ThrowingCallable callable = () -> userService.createUser(userToCreate);
MismatchedRoleException ex = catchThrowableOfType(callable, MismatchedRoleException.class); NotAuthorizedException ex = catchThrowableOfType(callable, NotAuthorizedException.class);
assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1"); assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(ex.getRoles()) assertThat(ex.getRoles())
.isEqualTo(new TaskanaRole[] {TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN}); .isEqualTo(new TaskanaRole[] {TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN});
@ -563,7 +563,7 @@ class UserServiceAccTest {
userService.updateUser(userToUpdate); userService.updateUser(userToUpdate);
}; };
MismatchedRoleException ex = catchThrowableOfType(callable, MismatchedRoleException.class); NotAuthorizedException ex = catchThrowableOfType(callable, NotAuthorizedException.class);
assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1"); assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(ex.getRoles()) assertThat(ex.getRoles())
.isEqualTo(new TaskanaRole[] {TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN}); .isEqualTo(new TaskanaRole[] {TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN});
@ -848,7 +848,7 @@ class UserServiceAccTest {
ThrowingCallable callable = () -> userService.deleteUser(userToDelete.getId()); ThrowingCallable callable = () -> userService.deleteUser(userToDelete.getId());
MismatchedRoleException ex = catchThrowableOfType(callable, MismatchedRoleException.class); NotAuthorizedException ex = catchThrowableOfType(callable, NotAuthorizedException.class);
assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1"); assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(ex.getRoles()) assertThat(ex.getRoles())
.isEqualTo(new TaskanaRole[] {TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN}); .isEqualTo(new TaskanaRole[] {TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN});

View File

@ -9,7 +9,7 @@ import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.ConcurrencyException; import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.DomainNotFoundException; import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
/** /**
@ -59,7 +59,7 @@ public interface ClassificationService {
* id}. * id}.
* @throws ClassificationAlreadyExistException if the {@linkplain Classification} already exists * @throws ClassificationAlreadyExistException if the {@linkplain Classification} already exists
* in the given {@linkplain Classification#getDomain() domain}. * in the given {@linkplain Classification#getDomain() domain}.
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
* @throws DomainNotFoundException if the {@linkplain Classification#getDomain() domain} does not * @throws DomainNotFoundException if the {@linkplain Classification#getDomain() domain} does not
* exist in the configuration * exist in the configuration
@ -69,7 +69,7 @@ public interface ClassificationService {
*/ */
Classification createClassification(Classification classification) Classification createClassification(Classification classification)
throws ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException, throws ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException,
MalformedServiceLevelException, MismatchedRoleException; MalformedServiceLevelException, NotAuthorizedException;
// READ // READ
@ -114,7 +114,7 @@ public interface ClassificationService {
* @return the updated {@linkplain Classification}. * @return the updated {@linkplain Classification}.
* @throws ClassificationNotFoundException if the specified {@linkplain Classification} or its * @throws ClassificationNotFoundException if the specified {@linkplain Classification} or its
* parent does not exist * parent does not exist
* @throws MismatchedRoleException if the caller is neither member of{@linkplain * @throws NotAuthorizedException if the caller is neither member of{@linkplain
* TaskanaRole#BUSINESS_ADMIN} nor {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} nor {@linkplain TaskanaRole#ADMIN}
* @throws ConcurrencyException if the {@linkplain Classification} was modified in the meantime * @throws ConcurrencyException if the {@linkplain Classification} was modified in the meantime
* and is not the most up to date anymore; that's the case if the given {@linkplain * and is not the most up to date anymore; that's the case if the given {@linkplain
@ -125,7 +125,7 @@ public interface ClassificationService {
*/ */
Classification updateClassification(Classification classification) Classification updateClassification(Classification classification)
throws ClassificationNotFoundException, ConcurrencyException, InvalidArgumentException, throws ClassificationNotFoundException, ConcurrencyException, InvalidArgumentException,
MalformedServiceLevelException, MismatchedRoleException; MalformedServiceLevelException, NotAuthorizedException;
// DELETE // DELETE
@ -139,11 +139,11 @@ public interface ClassificationService {
* {@linkplain Classification} * {@linkplain Classification}
* @throws ClassificationNotFoundException if no {@linkplain Classification} with the specified * @throws ClassificationNotFoundException if no {@linkplain Classification} with the specified
* {@linkplain Classification#getId() id} was found * {@linkplain Classification#getId() id} was found
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
*/ */
void deleteClassification(String id) void deleteClassification(String id)
throws ClassificationInUseException, ClassificationNotFoundException, MismatchedRoleException; throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException;
/** /**
* Deletes the {@linkplain Classification} identified by the provided {@linkplain * Deletes the {@linkplain Classification} identified by the provided {@linkplain
@ -161,11 +161,11 @@ public interface ClassificationService {
* @throws ClassificationNotFoundException if no {@linkplain Classification} with the specified * @throws ClassificationNotFoundException if no {@linkplain Classification} with the specified
* {@linkplain Classification#getKey() key} and {@linkplain Classification#getDomain() domain} * {@linkplain Classification#getKey() key} and {@linkplain Classification#getDomain() domain}
* was found * was found
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
*/ */
void deleteClassification(String classificationKey, String domain) void deleteClassification(String classificationKey, String domain)
throws ClassificationInUseException, ClassificationNotFoundException, MismatchedRoleException; throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException;
// endregion // endregion

View File

@ -30,7 +30,7 @@ import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.ConcurrencyException; import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.DomainNotFoundException; import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.common.internal.util.IdGenerator; import pro.taskana.common.internal.util.IdGenerator;
import pro.taskana.common.internal.util.LogSanitizer; import pro.taskana.common.internal.util.LogSanitizer;
@ -108,8 +108,7 @@ public class ClassificationServiceImpl implements ClassificationService {
@Override @Override
public void deleteClassification(String classificationId) public void deleteClassification(String classificationId)
throws ClassificationInUseException, ClassificationNotFoundException, throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException {
MismatchedRoleException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -164,8 +163,7 @@ public class ClassificationServiceImpl implements ClassificationService {
@Override @Override
public void deleteClassification(String classificationKey, String domain) public void deleteClassification(String classificationKey, String domain)
throws ClassificationInUseException, ClassificationNotFoundException, throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException {
MismatchedRoleException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -183,7 +181,7 @@ public class ClassificationServiceImpl implements ClassificationService {
@Override @Override
public Classification createClassification(Classification classification) public Classification createClassification(Classification classification)
throws ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException, throws ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException,
MalformedServiceLevelException, MismatchedRoleException { MalformedServiceLevelException, NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
if (!taskanaEngine.domainExists(classification.getDomain()) if (!taskanaEngine.domainExists(classification.getDomain())
&& !MASTER_DOMAIN.equals(classification.getDomain())) { && !MASTER_DOMAIN.equals(classification.getDomain())) {
@ -237,7 +235,7 @@ public class ClassificationServiceImpl implements ClassificationService {
@Override @Override
public Classification updateClassification(Classification classification) public Classification updateClassification(Classification classification)
throws ConcurrencyException, ClassificationNotFoundException, InvalidArgumentException, throws ConcurrencyException, ClassificationNotFoundException, InvalidArgumentException,
MalformedServiceLevelException, MismatchedRoleException { MalformedServiceLevelException, NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
ClassificationImpl classificationImpl; ClassificationImpl classificationImpl;
try { try {

View File

@ -5,7 +5,7 @@ import java.util.function.Supplier;
import pro.taskana.TaskanaConfiguration; import pro.taskana.TaskanaConfiguration;
import pro.taskana.classification.api.ClassificationService; import pro.taskana.classification.api.ClassificationService;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.security.CurrentUserContext; import pro.taskana.common.api.security.CurrentUserContext;
import pro.taskana.common.internal.TaskanaEngineImpl; import pro.taskana.common.internal.TaskanaEngineImpl;
import pro.taskana.common.internal.workingtime.WorkingTimeCalculatorImpl; import pro.taskana.common.internal.workingtime.WorkingTimeCalculatorImpl;
@ -190,10 +190,10 @@ public interface TaskanaEngine {
* *
* @param roles The {@linkplain TaskanaRole TaskanaRoles} that are checked for membership of the * @param roles The {@linkplain TaskanaRole TaskanaRoles} that are checked for membership of the
* current user * current user
* @throws MismatchedRoleException If the current user is not member of any specified {@linkplain * @throws NotAuthorizedException If the current user is not member of any specified {@linkplain
* TaskanaRole TaskanaRole} * TaskanaRole TaskanaRole}
*/ */
void checkRoleMembership(TaskanaRole... roles) throws MismatchedRoleException; void checkRoleMembership(TaskanaRole... roles) throws NotAuthorizedException;
/** /**
* Executes a given {@code Supplier} with admin privileges and thus skips further permission * Executes a given {@code Supplier} with admin privileges and thus skips further permission

View File

@ -39,7 +39,7 @@ import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.WorkingTimeCalculator; import pro.taskana.common.api.WorkingTimeCalculator;
import pro.taskana.common.api.exceptions.AutocommitFailedException; import pro.taskana.common.api.exceptions.AutocommitFailedException;
import pro.taskana.common.api.exceptions.ConnectionNotSetException; import pro.taskana.common.api.exceptions.ConnectionNotSetException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.api.security.CurrentUserContext; import pro.taskana.common.api.security.CurrentUserContext;
import pro.taskana.common.api.security.UserPrincipal; import pro.taskana.common.api.security.UserPrincipal;
@ -319,7 +319,7 @@ public class TaskanaEngineImpl implements TaskanaEngine {
} }
@Override @Override
public void checkRoleMembership(TaskanaRole... roles) throws MismatchedRoleException { public void checkRoleMembership(TaskanaRole... roles) throws NotAuthorizedException {
if (!isUserInRole(roles)) { if (!isUserInRole(roles)) {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
String rolesAsString = Arrays.toString(roles); String rolesAsString = Arrays.toString(roles);
@ -328,7 +328,7 @@ public class TaskanaEngineImpl implements TaskanaEngine {
currentUserContext.getAccessIds(), currentUserContext.getAccessIds(),
rolesAsString); rolesAsString);
} }
throw new MismatchedRoleException(currentUserContext.getUserid(), roles); throw new NotAuthorizedException(currentUserContext.getUserid(), roles);
} }
} }

View File

@ -5,7 +5,7 @@ import java.util.List;
import pro.taskana.classification.api.models.Classification; import pro.taskana.classification.api.models.Classification;
import pro.taskana.common.api.TimeInterval; import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
import pro.taskana.monitor.api.reports.header.ColumnHeader; import pro.taskana.monitor.api.reports.header.ColumnHeader;
import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader; import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader;
@ -34,10 +34,10 @@ public class ClassificationCategoryReport
@Override @Override
ClassificationCategoryReport buildReport() ClassificationCategoryReport buildReport()
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
@Override @Override
ClassificationCategoryReport buildReport(TaskTimestamp timestamp) ClassificationCategoryReport buildReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
} }
} }

View File

@ -6,7 +6,7 @@ import pro.taskana.classification.api.models.Classification;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.TimeInterval; import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
import pro.taskana.monitor.api.reports.header.ColumnHeader; import pro.taskana.monitor.api.reports.header.ColumnHeader;
import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader; import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader;
@ -36,11 +36,11 @@ public class ClassificationReport extends Report<MonitorQueryItem, TimeIntervalC
extends TimeIntervalReportBuilder<Builder, MonitorQueryItem, TimeIntervalColumnHeader> { extends TimeIntervalReportBuilder<Builder, MonitorQueryItem, TimeIntervalColumnHeader> {
@Override @Override
ClassificationReport buildReport() throws InvalidArgumentException, MismatchedRoleException; ClassificationReport buildReport() throws InvalidArgumentException, NotAuthorizedException;
@Override @Override
ClassificationReport buildReport(TaskTimestamp timestamp) ClassificationReport buildReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
/** /**
* Returns a {@linkplain DetailedClassificationReport} containing all tasks after applying the * Returns a {@linkplain DetailedClassificationReport} containing all tasks after applying the
@ -50,14 +50,14 @@ public class ClassificationReport extends Report<MonitorQueryItem, TimeIntervalC
* *
* @return the DetailedClassificationReport * @return the DetailedClassificationReport
* @throws InvalidArgumentException if the column headers are not initialized * @throws InvalidArgumentException if the column headers are not initialized
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#MONITOR} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#MONITOR} or {@linkplain TaskanaRole#ADMIN}
*/ */
DetailedClassificationReport buildDetailedReport() DetailedClassificationReport buildDetailedReport()
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
DetailedClassificationReport buildDetailedReport(TaskTimestamp timestamp) DetailedClassificationReport buildDetailedReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
} }
/** /**

View File

@ -8,7 +8,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.monitor.api.reports.header.ColumnHeader; import pro.taskana.monitor.api.reports.header.ColumnHeader;
import pro.taskana.monitor.api.reports.item.QueryItem; import pro.taskana.monitor.api.reports.item.QueryItem;
import pro.taskana.monitor.api.reports.item.QueryItemPreprocessor; import pro.taskana.monitor.api.reports.item.QueryItemPreprocessor;
@ -133,6 +133,6 @@ public abstract class Report<I extends QueryItem, H extends ColumnHeader<? super
*/ */
public interface Builder<I extends QueryItem, H extends ColumnHeader<? super I>> { public interface Builder<I extends QueryItem, H extends ColumnHeader<? super I>> {
Report<I, H> buildReport() throws InvalidArgumentException, MismatchedRoleException; Report<I, H> buildReport() throws InvalidArgumentException, NotAuthorizedException;
} }
} }

View File

@ -4,7 +4,7 @@ import java.util.List;
import pro.taskana.common.api.TimeInterval; import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
import pro.taskana.monitor.api.reports.header.ColumnHeader; import pro.taskana.monitor.api.reports.header.ColumnHeader;
import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader; import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader;
@ -32,10 +32,10 @@ public class TaskCustomFieldValueReport extends Report<MonitorQueryItem, TimeInt
@Override @Override
TaskCustomFieldValueReport buildReport() TaskCustomFieldValueReport buildReport()
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
@Override @Override
TaskCustomFieldValueReport buildReport(TaskTimestamp timestamp) TaskCustomFieldValueReport buildReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
} }
} }

View File

@ -4,7 +4,7 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.monitor.api.reports.header.ColumnHeader; import pro.taskana.monitor.api.reports.header.ColumnHeader;
import pro.taskana.monitor.api.reports.header.TaskStatusColumnHeader; import pro.taskana.monitor.api.reports.header.TaskStatusColumnHeader;
import pro.taskana.monitor.api.reports.item.TaskQueryItem; import pro.taskana.monitor.api.reports.item.TaskQueryItem;
@ -34,7 +34,7 @@ public class TaskStatusReport extends Report<TaskQueryItem, TaskStatusColumnHead
public interface Builder extends Report.Builder<TaskQueryItem, TaskStatusColumnHeader> { public interface Builder extends Report.Builder<TaskQueryItem, TaskStatusColumnHeader> {
@Override @Override
TaskStatusReport buildReport() throws MismatchedRoleException; TaskStatusReport buildReport() throws NotAuthorizedException;
/** /**
* Adds a list of states to the builder. The created report contains only tasks with a state in * Adds a list of states to the builder. The created report contains only tasks with a state in

View File

@ -5,7 +5,7 @@ import java.util.List;
import pro.taskana.common.api.IntInterval; import pro.taskana.common.api.IntInterval;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.monitor.api.SelectedItem; import pro.taskana.monitor.api.SelectedItem;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader; import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader;
@ -216,33 +216,33 @@ public interface TimeIntervalReportBuilder<
* @param timestamp the {@linkplain TaskTimestamp} of interest * @param timestamp the {@linkplain TaskTimestamp} of interest
* @return the list of all taskIds * @return the list of all taskIds
* @throws InvalidArgumentException if the column headers are not initialized * @throws InvalidArgumentException if the column headers are not initialized
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#MONITOR} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#MONITOR} or {@linkplain TaskanaRole#ADMIN}
*/ */
List<String> listTaskIdsForSelectedItems( List<String> listTaskIdsForSelectedItems(
List<SelectedItem> selectedItems, TaskTimestamp timestamp) List<SelectedItem> selectedItems, TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
/** /**
* Returns a list of all values of an entered custom field that are in the {@linkplain Report}. * Returns a list of all values of an entered custom field that are in the {@linkplain Report}.
* *
* @param taskCustomField the {@linkplain TaskCustomField} whose values should appear in the list * @param taskCustomField the {@linkplain TaskCustomField} whose values should appear in the list
* @return the list of all custom attribute values * @return the list of all custom attribute values
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#MONITOR} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#MONITOR} or {@linkplain TaskanaRole#ADMIN}
*/ */
List<String> listCustomAttributeValuesForCustomAttributeName(TaskCustomField taskCustomField) List<String> listCustomAttributeValuesForCustomAttributeName(TaskCustomField taskCustomField)
throws MismatchedRoleException; throws NotAuthorizedException;
/** /**
* Builds the {@linkplain Report} for the specified {@linkplain TaskTimestamp}. * Builds the {@linkplain Report} for the specified {@linkplain TaskTimestamp}.
* *
* @param timestamp The {@linkplain TaskTimestamp} of interest * @param timestamp The {@linkplain TaskTimestamp} of interest
* @return The build {@linkplain Report} * @return The build {@linkplain Report}
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#MONITOR} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#MONITOR} or {@linkplain TaskanaRole#ADMIN}
* @throws InvalidArgumentException if an error occurs * @throws InvalidArgumentException if an error occurs
*/ */
Report<I, H> buildReport(TaskTimestamp timestamp) Report<I, H> buildReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
} }

View File

@ -4,7 +4,7 @@ import java.util.List;
import pro.taskana.common.api.TimeInterval; import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
import pro.taskana.monitor.api.reports.header.ColumnHeader; import pro.taskana.monitor.api.reports.header.ColumnHeader;
import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader; import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader;
@ -45,7 +45,7 @@ public class TimestampReport extends Report<TimestampQueryItem, TimeIntervalColu
TimestampReport.Builder, TimestampQueryItem, TimeIntervalColumnHeader> { TimestampReport.Builder, TimestampQueryItem, TimeIntervalColumnHeader> {
@Override @Override
TimestampReport buildReport() throws InvalidArgumentException, MismatchedRoleException; TimestampReport buildReport() throws InvalidArgumentException, NotAuthorizedException;
Builder withTimestamps(List<TaskTimestamp> taskTimestamps); Builder withTimestamps(List<TaskTimestamp> taskTimestamps);
} }

View File

@ -4,7 +4,7 @@ import java.util.List;
import pro.taskana.common.api.IntInterval; import pro.taskana.common.api.IntInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.monitor.api.reports.header.ColumnHeader; import pro.taskana.monitor.api.reports.header.ColumnHeader;
import pro.taskana.monitor.api.reports.header.PriorityColumnHeader; import pro.taskana.monitor.api.reports.header.PriorityColumnHeader;
import pro.taskana.monitor.api.reports.item.PriorityQueryItem; import pro.taskana.monitor.api.reports.item.PriorityQueryItem;
@ -33,7 +33,7 @@ public class WorkbasketPriorityReport extends Report<PriorityQueryItem, Priority
public interface Builder extends Report.Builder<PriorityQueryItem, PriorityColumnHeader> { public interface Builder extends Report.Builder<PriorityQueryItem, PriorityColumnHeader> {
@Override @Override
WorkbasketPriorityReport buildReport() throws MismatchedRoleException; WorkbasketPriorityReport buildReport() throws NotAuthorizedException;
/** /**
* Adds {@linkplain WorkbasketType WorkbasketTypes} to the builder. The created report will only * Adds {@linkplain WorkbasketType WorkbasketTypes} to the builder. The created report will only

View File

@ -4,7 +4,7 @@ import java.util.List;
import pro.taskana.common.api.TimeInterval; import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.monitor.api.CombinedClassificationFilter; import pro.taskana.monitor.api.CombinedClassificationFilter;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
import pro.taskana.monitor.api.reports.header.ColumnHeader; import pro.taskana.monitor.api.reports.header.ColumnHeader;
@ -32,11 +32,11 @@ public class WorkbasketReport extends Report<MonitorQueryItem, TimeIntervalColum
extends TimeIntervalReportBuilder<Builder, MonitorQueryItem, TimeIntervalColumnHeader> { extends TimeIntervalReportBuilder<Builder, MonitorQueryItem, TimeIntervalColumnHeader> {
@Override @Override
WorkbasketReport buildReport() throws InvalidArgumentException, MismatchedRoleException; WorkbasketReport buildReport() throws InvalidArgumentException, NotAuthorizedException;
@Override @Override
WorkbasketReport buildReport(TaskTimestamp timestamp) WorkbasketReport buildReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
/** /**
* Adds a list of {@linkplain CombinedClassificationFilter} to the builder. The created report * Adds a list of {@linkplain CombinedClassificationFilter} to the builder. The created report

View File

@ -5,7 +5,7 @@ import java.util.List;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
import pro.taskana.monitor.api.reports.ClassificationCategoryReport; import pro.taskana.monitor.api.reports.ClassificationCategoryReport;
@ -27,13 +27,13 @@ public class ClassificationCategoryReportBuilderImpl
@Override @Override
public ClassificationCategoryReport buildReport() public ClassificationCategoryReport buildReport()
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
return buildReport(TaskTimestamp.DUE); return buildReport(TaskTimestamp.DUE);
} }
@Override @Override
public ClassificationCategoryReport buildReport(TaskTimestamp timestamp) public ClassificationCategoryReport buildReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN);
try { try {
this.taskanaEngine.openConnection(); this.taskanaEngine.openConnection();

View File

@ -10,7 +10,7 @@ import pro.taskana.classification.api.ClassificationService;
import pro.taskana.classification.api.models.ClassificationSummary; import pro.taskana.classification.api.models.ClassificationSummary;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
import pro.taskana.monitor.api.reports.ClassificationReport; import pro.taskana.monitor.api.reports.ClassificationReport;
@ -38,13 +38,13 @@ public class ClassificationReportBuilderImpl
@Override @Override
public ClassificationReport buildReport() public ClassificationReport buildReport()
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
return buildReport(TaskTimestamp.DUE); return buildReport(TaskTimestamp.DUE);
} }
@Override @Override
public ClassificationReport buildReport(TaskTimestamp timestamp) public ClassificationReport buildReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN);
try { try {
this.taskanaEngine.openConnection(); this.taskanaEngine.openConnection();
@ -77,13 +77,13 @@ public class ClassificationReportBuilderImpl
@Override @Override
public DetailedClassificationReport buildDetailedReport() public DetailedClassificationReport buildDetailedReport()
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
return buildDetailedReport(TaskTimestamp.DUE); return buildDetailedReport(TaskTimestamp.DUE);
} }
@Override @Override
public DetailedClassificationReport buildDetailedReport(TaskTimestamp timestamp) public DetailedClassificationReport buildDetailedReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN);
try { try {
this.taskanaEngine.openConnection(); this.taskanaEngine.openConnection();

View File

@ -5,7 +5,7 @@ import java.util.List;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
import pro.taskana.monitor.api.reports.TaskCustomFieldValueReport; import pro.taskana.monitor.api.reports.TaskCustomFieldValueReport;
@ -33,13 +33,13 @@ public class TaskCustomFieldValueReportBuilderImpl
@Override @Override
public TaskCustomFieldValueReport buildReport() public TaskCustomFieldValueReport buildReport()
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
return buildReport(TaskTimestamp.DUE); return buildReport(TaskTimestamp.DUE);
} }
@Override @Override
public TaskCustomFieldValueReport buildReport(TaskTimestamp timestamp) public TaskCustomFieldValueReport buildReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN);
try { try {
this.taskanaEngine.openConnection(); this.taskanaEngine.openConnection();

View File

@ -6,7 +6,7 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.monitor.api.reports.TaskStatusReport; import pro.taskana.monitor.api.reports.TaskStatusReport;
import pro.taskana.monitor.api.reports.TaskStatusReport.Builder; import pro.taskana.monitor.api.reports.TaskStatusReport.Builder;
@ -35,7 +35,7 @@ public class TaskStatusReportBuilderImpl implements TaskStatusReport.Builder {
} }
@Override @Override
public TaskStatusReport buildReport() throws MismatchedRoleException { public TaskStatusReport buildReport() throws NotAuthorizedException {
this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN);
try { try {
this.taskanaEngine.openConnection(); this.taskanaEngine.openConnection();

View File

@ -9,7 +9,7 @@ import pro.taskana.common.api.IntInterval;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.WorkingTimeCalculator; import pro.taskana.common.api.WorkingTimeCalculator;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.monitor.api.CombinedClassificationFilter; import pro.taskana.monitor.api.CombinedClassificationFilter;
@ -547,7 +547,7 @@ abstract class TimeIntervalReportBuilderImpl<
@Override @Override
public List<String> listTaskIdsForSelectedItems( public List<String> listTaskIdsForSelectedItems(
List<SelectedItem> selectedItems, TaskTimestamp timestamp) List<SelectedItem> selectedItems, TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR);
try { try {
@ -583,7 +583,7 @@ abstract class TimeIntervalReportBuilderImpl<
@Override @Override
public List<String> listCustomAttributeValuesForCustomAttributeName( public List<String> listCustomAttributeValuesForCustomAttributeName(
TaskCustomField taskCustomField) throws MismatchedRoleException { TaskCustomField taskCustomField) throws NotAuthorizedException {
this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR);
try { try {
this.taskanaEngine.openConnection(); this.taskanaEngine.openConnection();

View File

@ -9,7 +9,7 @@ import java.util.stream.Collectors;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.monitor.api.SelectedItem; import pro.taskana.monitor.api.SelectedItem;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
@ -55,12 +55,12 @@ public class TimestampReportBuilderImpl
@Override @Override
public Report<TimestampQueryItem, TimeIntervalColumnHeader> buildReport(TaskTimestamp timestamp) public Report<TimestampQueryItem, TimeIntervalColumnHeader> buildReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
return buildReport(); return buildReport();
} }
@Override @Override
public TimestampReport buildReport() throws InvalidArgumentException, MismatchedRoleException { public TimestampReport buildReport() throws InvalidArgumentException, NotAuthorizedException {
this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN);
try { try {
this.taskanaEngine.openConnection(); this.taskanaEngine.openConnection();

View File

@ -6,7 +6,7 @@ import java.util.List;
import pro.taskana.common.api.IntInterval; import pro.taskana.common.api.IntInterval;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.monitor.api.reports.WorkbasketPriorityReport; import pro.taskana.monitor.api.reports.WorkbasketPriorityReport;
@ -123,7 +123,7 @@ public class WorkbasketPriorityReportBuilderImpl implements WorkbasketPriorityRe
} }
@Override @Override
public WorkbasketPriorityReport buildReport() throws MismatchedRoleException { public WorkbasketPriorityReport buildReport() throws NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN);
WorkbasketPriorityReport report = new WorkbasketPriorityReport(columnHeaders); WorkbasketPriorityReport report = new WorkbasketPriorityReport(columnHeaders);

View File

@ -7,7 +7,7 @@ import java.util.stream.Collectors;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.monitor.api.CombinedClassificationFilter; import pro.taskana.monitor.api.CombinedClassificationFilter;
import pro.taskana.monitor.api.TaskTimestamp; import pro.taskana.monitor.api.TaskTimestamp;
@ -34,13 +34,13 @@ public class WorkbasketReportBuilderImpl
} }
@Override @Override
public WorkbasketReport buildReport() throws InvalidArgumentException, MismatchedRoleException { public WorkbasketReport buildReport() throws InvalidArgumentException, NotAuthorizedException {
return buildReport(TaskTimestamp.DUE); return buildReport(TaskTimestamp.DUE);
} }
@Override @Override
public WorkbasketReport buildReport(TaskTimestamp timestamp) public WorkbasketReport buildReport(TaskTimestamp timestamp)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN);
try { try {
this.taskanaEngine.openConnection(); this.taskanaEngine.openConnection();

View File

@ -5,7 +5,7 @@ import java.util.List;
import pro.taskana.common.api.TaskanaEngine; import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent; import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent; import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent; import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
@ -46,9 +46,9 @@ public interface TaskanaHistory {
* *
* @param taskIds the task ids for which all history events must be deleted * @param taskIds the task ids for which all history events must be deleted
* @throws InvalidArgumentException If the list of taskIds is null * @throws InvalidArgumentException If the list of taskIds is null
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#ADMIN} * TaskanaRole#ADMIN}
*/ */
void deleteHistoryEventsByTaskIds(List<String> taskIds) void deleteHistoryEventsByTaskIds(List<String> taskIds)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
} }

View File

@ -10,14 +10,14 @@ import pro.taskana.common.api.BulkOperationResults;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.ConcurrencyException; import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.TaskanaException; import pro.taskana.common.api.exceptions.TaskanaException;
import pro.taskana.spi.routing.api.TaskRoutingProvider; import pro.taskana.spi.routing.api.TaskRoutingProvider;
import pro.taskana.task.api.exceptions.AttachmentPersistenceException; import pro.taskana.task.api.exceptions.AttachmentPersistenceException;
import pro.taskana.task.api.exceptions.InvalidCallbackStateException; import pro.taskana.task.api.exceptions.InvalidCallbackStateException;
import pro.taskana.task.api.exceptions.InvalidOwnerException; import pro.taskana.task.api.exceptions.InvalidOwnerException;
import pro.taskana.task.api.exceptions.InvalidTaskStateException; import pro.taskana.task.api.exceptions.InvalidTaskStateException;
import pro.taskana.task.api.exceptions.MismatchedTaskCommentCreatorException; import pro.taskana.task.api.exceptions.NotAuthorizedOnTaskCommentException;
import pro.taskana.task.api.exceptions.ObjectReferencePersistenceException; import pro.taskana.task.api.exceptions.ObjectReferencePersistenceException;
import pro.taskana.task.api.exceptions.TaskAlreadyExistException; import pro.taskana.task.api.exceptions.TaskAlreadyExistException;
import pro.taskana.task.api.exceptions.TaskCommentNotFoundException; import pro.taskana.task.api.exceptions.TaskCommentNotFoundException;
@ -27,7 +27,7 @@ import pro.taskana.task.api.models.ObjectReference;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.task.api.models.TaskComment; import pro.taskana.task.api.models.TaskComment;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.api.models.Workbasket; import pro.taskana.workbasket.api.models.Workbasket;
@ -107,7 +107,7 @@ public interface TaskService {
* @param taskToCreate the transient {@linkplain Task} to be inserted * @param taskToCreate the transient {@linkplain Task} to be inserted
* @return the created and inserted {@linkplain Task} * @return the created and inserted {@linkplain Task}
* @throws TaskAlreadyExistException if the {@linkplain Task} already exists * @throws TaskAlreadyExistException if the {@linkplain Task} already exists
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#APPEND} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#APPEND} for the {@linkplain Workbasket} the {@linkplain Task} is in
* @throws WorkbasketNotFoundException if the {@linkplain Workbasket} referenced by the * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} referenced by the
* {@linkplain Task#getWorkbasketSummary() workbasketSummary} of the {@linkplain Task} isn't * {@linkplain Task#getWorkbasketSummary() workbasketSummary} of the {@linkplain Task} isn't
@ -127,7 +127,7 @@ public interface TaskService {
Task createTask(Task taskToCreate) Task createTask(Task taskToCreate)
throws WorkbasketNotFoundException, ClassificationNotFoundException, throws WorkbasketNotFoundException, ClassificationNotFoundException,
TaskAlreadyExistException, InvalidArgumentException, AttachmentPersistenceException, TaskAlreadyExistException, InvalidArgumentException, AttachmentPersistenceException,
ObjectReferencePersistenceException, MismatchedWorkbasketPermissionException; ObjectReferencePersistenceException, NotAuthorizedOnWorkbasketException;
// endregion // endregion
@ -139,10 +139,10 @@ public interface TaskService {
* @param taskId the {@linkplain Task#getId() id} of the {@linkplain Task} * @param taskId the {@linkplain Task#getId() id} of the {@linkplain Task}
* @return the {@linkplain Task} with the specified taskId * @return the {@linkplain Task} with the specified taskId
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task getTask(String taskId) throws TaskNotFoundException, MismatchedWorkbasketPermissionException; Task getTask(String taskId) throws TaskNotFoundException, NotAuthorizedOnWorkbasketException;
// endregion // endregion
@ -157,11 +157,11 @@ public interface TaskService {
* @throws InvalidTaskStateException if the {@linkplain Task#getState() state} of the {@linkplain * @throws InvalidTaskStateException if the {@linkplain Task#getState() state} of the {@linkplain
* Task} with taskId isn't {@linkplain TaskState#READY} * Task} with taskId isn't {@linkplain TaskState#READY}
* @throws InvalidOwnerException if the {@linkplain Task} with taskId is claimed by some else * @throws InvalidOwnerException if the {@linkplain Task} with taskId is claimed by some else
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task claim(String taskId) Task claim(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException; InvalidTaskStateException;
/** /**
@ -174,11 +174,11 @@ public interface TaskService {
* @throws InvalidTaskStateException if the state of Task with taskId is in {@linkplain * @throws InvalidTaskStateException if the state of Task with taskId is in {@linkplain
* TaskState#END_STATES} * TaskState#END_STATES}
* @throws InvalidOwnerException cannot be thrown * @throws InvalidOwnerException cannot be thrown
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task forceClaim(String taskId) Task forceClaim(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException; InvalidTaskStateException;
/** /**
@ -187,11 +187,11 @@ public interface TaskService {
* @param taskQuery the {@linkplain TaskQuery} * @param taskQuery the {@linkplain TaskQuery}
* @return the {@linkplain Task} that got selected and claimed * @return the {@linkplain Task} that got selected and claimed
* @throws InvalidOwnerException if the {@linkplain Task} is claimed by someone else * @throws InvalidOwnerException if the {@linkplain Task} is claimed by someone else
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task selectAndClaim(TaskQuery taskQuery) Task selectAndClaim(TaskQuery taskQuery)
throws InvalidOwnerException, MismatchedWorkbasketPermissionException; throws InvalidOwnerException, NotAuthorizedOnWorkbasketException;
/** /**
* Cancel the claim of an existing {@linkplain Task} if it was claimed by the current user before. * Cancel the claim of an existing {@linkplain Task} if it was claimed by the current user before.
@ -203,11 +203,11 @@ public interface TaskService {
* @throws InvalidTaskStateException if the {@linkplain Task} is already in one of the {@linkplain * @throws InvalidTaskStateException if the {@linkplain Task} is already in one of the {@linkplain
* TaskState#END_STATES} * TaskState#END_STATES}
* @throws InvalidOwnerException if the {@linkplain Task} is claimed by another user * @throws InvalidOwnerException if the {@linkplain Task} is claimed by another user
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task cancelClaim(String taskId) Task cancelClaim(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException; InvalidTaskStateException;
/** /**
@ -220,11 +220,11 @@ public interface TaskService {
* @throws InvalidTaskStateException if the {@linkplain Task} is already in one of the {@linkplain * @throws InvalidTaskStateException if the {@linkplain Task} is already in one of the {@linkplain
* TaskState#END_STATES} * TaskState#END_STATES}
* @throws InvalidOwnerException cannot be thrown * @throws InvalidOwnerException cannot be thrown
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task forceCancelClaim(String taskId) Task forceCancelClaim(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException; InvalidTaskStateException;
/** /**
@ -236,12 +236,12 @@ public interface TaskService {
* Task} with taskId is not in {@linkplain TaskState#CLAIMED} * Task} with taskId is not in {@linkplain TaskState#CLAIMED}
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws InvalidOwnerException if the {@linkplain Task} is claimed by another user * @throws InvalidOwnerException if the {@linkplain Task} is claimed by another user
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task requestReview(String taskId) Task requestReview(String taskId)
throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException,
MismatchedWorkbasketPermissionException; NotAuthorizedOnWorkbasketException;
/** /**
* Request review for an existing {@linkplain Task} even if the current user is not the * Request review for an existing {@linkplain Task} even if the current user is not the
@ -253,12 +253,12 @@ public interface TaskService {
* Task} with taskId is one of the {@linkplain TaskState#END_STATES} * Task} with taskId is one of the {@linkplain TaskState#END_STATES}
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws InvalidOwnerException cannot be thrown * @throws InvalidOwnerException cannot be thrown
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task forceRequestReview(String taskId) Task forceRequestReview(String taskId)
throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException,
MismatchedWorkbasketPermissionException; NotAuthorizedOnWorkbasketException;
/** /**
* Request changes for an existing {@linkplain Task} that is in {@linkplain TaskState#IN_REVIEW}. * Request changes for an existing {@linkplain Task} that is in {@linkplain TaskState#IN_REVIEW}.
@ -271,12 +271,12 @@ public interface TaskService {
* Task} with taskId is not in {@linkplain TaskState#IN_REVIEW} * Task} with taskId is not in {@linkplain TaskState#IN_REVIEW}
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws InvalidOwnerException if the {@linkplain Task} is claimed by another user * @throws InvalidOwnerException if the {@linkplain Task} is claimed by another user
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task requestChanges(String taskId) Task requestChanges(String taskId)
throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException,
MismatchedWorkbasketPermissionException; NotAuthorizedOnWorkbasketException;
/** /**
* Request changes for an existing {@linkplain Task} even if the current user is not the * Request changes for an existing {@linkplain Task} even if the current user is not the
@ -290,12 +290,12 @@ public interface TaskService {
* Task} with taskId is one of the {@linkplain TaskState#END_STATES} * Task} with taskId is one of the {@linkplain TaskState#END_STATES}
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws InvalidOwnerException cannot be thrown * @throws InvalidOwnerException cannot be thrown
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task forceRequestChanges(String taskId) Task forceRequestChanges(String taskId)
throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException,
MismatchedWorkbasketPermissionException; NotAuthorizedOnWorkbasketException;
/** /**
* Complete a claimed {@linkplain Task} as {@linkplain Task#getOwner() owner} or {@linkplain * Complete a claimed {@linkplain Task} as {@linkplain Task#getOwner() owner} or {@linkplain
@ -312,11 +312,11 @@ public interface TaskService {
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws InvalidOwnerException if current user isn't the {@linkplain Task#getOwner() owner} of * @throws InvalidOwnerException if current user isn't the {@linkplain Task#getOwner() owner} of
* the {@linkplain Task} or {@linkplain TaskanaRole#ADMIN} * the {@linkplain Task} or {@linkplain TaskanaRole#ADMIN}
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task completeTask(String taskId) Task completeTask(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException; InvalidTaskStateException;
/** /**
@ -334,11 +334,11 @@ public interface TaskService {
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws InvalidOwnerException if current user isn't the {@linkplain Task#getOwner() owner} of * @throws InvalidOwnerException if current user isn't the {@linkplain Task#getOwner() owner} of
* the {@linkplain Task} or {@linkplain TaskanaRole#ADMIN} * the {@linkplain Task} or {@linkplain TaskanaRole#ADMIN}
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task forceCompleteTask(String taskId) Task forceCompleteTask(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException; InvalidTaskStateException;
/** /**
@ -381,12 +381,11 @@ public interface TaskService {
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws InvalidTaskStateException if the {@linkplain Task} isn't in {@linkplain * @throws InvalidTaskStateException if the {@linkplain Task} isn't in {@linkplain
* TaskState#READY} or {@linkplain TaskState#CLAIMED} * TaskState#READY} or {@linkplain TaskState#CLAIMED}
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task cancelTask(String taskId) Task cancelTask(String taskId)
throws TaskNotFoundException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException;
InvalidTaskStateException;
/** /**
* Terminates a {@linkplain Task}. Termination is an administrative action to complete a * Terminates a {@linkplain Task}. Termination is an administrative action to complete a
@ -399,14 +398,14 @@ public interface TaskService {
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws InvalidTaskStateException if the {@linkplain Task} isn't in {@linkplain * @throws InvalidTaskStateException if the {@linkplain Task} isn't in {@linkplain
* TaskState#READY} or {@linkplain TaskState#CLAIMED} * TaskState#READY} or {@linkplain TaskState#CLAIMED}
* @throws MismatchedRoleException if the current user isn't member of {@linkplain * @throws NotAuthorizedException if the current user isn't member of {@linkplain
* TaskanaRole#ADMIN} or {@linkplain TaskanaRole#TASK_ADMIN} * TaskanaRole#ADMIN} or {@linkplain TaskanaRole#TASK_ADMIN}
* @throws MismatchedWorkbasketPermissionException If the current user doesn't have the correct * @throws NotAuthorizedOnWorkbasketException If the current user doesn't have the correct
* permission * permission
*/ */
Task terminateTask(String taskId) Task terminateTask(String taskId)
throws TaskNotFoundException, MismatchedRoleException, throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException; InvalidTaskStateException;
/** /**
* Transfers a {@linkplain Task} to another {@linkplain Workbasket} while always setting * Transfers a {@linkplain Task} to another {@linkplain Workbasket} while always setting
@ -416,8 +415,8 @@ public interface TaskService {
*/ */
@SuppressWarnings("checkstyle:JavadocMethod") @SuppressWarnings("checkstyle:JavadocMethod")
default Task transfer(String taskId, String destinationWorkbasketId) default Task transfer(String taskId, String destinationWorkbasketId)
throws TaskNotFoundException, WorkbasketNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException { InvalidTaskStateException {
return transfer(taskId, destinationWorkbasketId, true); return transfer(taskId, destinationWorkbasketId, true);
} }
@ -436,15 +435,15 @@ public interface TaskService {
* @return the transferred {@linkplain Task} * @return the transferred {@linkplain Task}
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws WorkbasketNotFoundException if the target {@linkplain Workbasket} was not found * @throws WorkbasketNotFoundException if the target {@linkplain Workbasket} was not found
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the source {@linkplain Workbasket} or no {@linkplain * WorkbasketPermission#READ} for the source {@linkplain Workbasket} or no {@linkplain
* WorkbasketPermission#TRANSFER} for the target {@linkplain Workbasket} * WorkbasketPermission#TRANSFER} for the target {@linkplain Workbasket}
* @throws InvalidTaskStateException if the {@linkplain Task} is in one of the {@linkplain * @throws InvalidTaskStateException if the {@linkplain Task} is in one of the {@linkplain
* TaskState#END_STATES} * TaskState#END_STATES}
*/ */
Task transfer(String taskId, String destinationWorkbasketId, boolean setTransferFlag) Task transfer(String taskId, String destinationWorkbasketId, boolean setTransferFlag)
throws TaskNotFoundException, WorkbasketNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException; InvalidTaskStateException;
/** /**
* Transfers a {@linkplain Task} to another {@linkplain Workbasket} while always setting * Transfers a {@linkplain Task} to another {@linkplain Workbasket} while always setting
@ -454,8 +453,8 @@ public interface TaskService {
*/ */
@SuppressWarnings("checkstyle:JavadocMethod") @SuppressWarnings("checkstyle:JavadocMethod")
default Task transfer(String taskId, String workbasketKey, String domain) default Task transfer(String taskId, String workbasketKey, String domain)
throws TaskNotFoundException, WorkbasketNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException { InvalidTaskStateException {
return transfer(taskId, workbasketKey, domain, true); return transfer(taskId, workbasketKey, domain, true);
} }
@ -476,15 +475,15 @@ public interface TaskService {
* @return the transferred {@linkplain Task} * @return the transferred {@linkplain Task}
* @throws TaskNotFoundException if the {@linkplain Task} with taskId was not found * @throws TaskNotFoundException if the {@linkplain Task} with taskId was not found
* @throws WorkbasketNotFoundException if the target {@linkplain Workbasket} was not found * @throws WorkbasketNotFoundException if the target {@linkplain Workbasket} was not found
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the source {@linkplain Workbasket} or no {@linkplain * WorkbasketPermission#READ} for the source {@linkplain Workbasket} or no {@linkplain
* WorkbasketPermission#TRANSFER} for the target {@linkplain Workbasket} * WorkbasketPermission#TRANSFER} for the target {@linkplain Workbasket}
* @throws InvalidTaskStateException if the {@linkplain Task} is in one of the {@linkplain * @throws InvalidTaskStateException if the {@linkplain Task} is in one of the {@linkplain
* TaskState#END_STATES} * TaskState#END_STATES}
*/ */
Task transfer(String taskId, String workbasketKey, String domain, boolean setTransferFlag) Task transfer(String taskId, String workbasketKey, String domain, boolean setTransferFlag)
throws TaskNotFoundException, WorkbasketNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException; InvalidTaskStateException;
/** /**
* Transfers a List of {@linkplain Task Tasks} to another {@linkplain Workbasket} while always * Transfers a List of {@linkplain Task Tasks} to another {@linkplain Workbasket} while always
@ -496,7 +495,7 @@ public interface TaskService {
default BulkOperationResults<String, TaskanaException> transferTasks( default BulkOperationResults<String, TaskanaException> transferTasks(
String destinationWorkbasketId, List<String> taskIds) String destinationWorkbasketId, List<String> taskIds)
throws InvalidArgumentException, WorkbasketNotFoundException, throws InvalidArgumentException, WorkbasketNotFoundException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
return transferTasks(destinationWorkbasketId, taskIds, true); return transferTasks(destinationWorkbasketId, taskIds, true);
} }
@ -514,7 +513,7 @@ public interface TaskService {
* @param setTransferFlag controls whether to set {@linkplain Task#isTransferred() isTransferred} * @param setTransferFlag controls whether to set {@linkplain Task#isTransferred() isTransferred}
* or not * or not
* @return Bulkresult with {@linkplain Task#getId() ids} and Error for each failed transactions * @return Bulkresult with {@linkplain Task#getId() ids} and Error for each failed transactions
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the source {@linkplain Workbasket} or no {@linkplain * WorkbasketPermission#READ} for the source {@linkplain Workbasket} or no {@linkplain
* WorkbasketPermission#TRANSFER} for the target {@linkplain Workbasket} * WorkbasketPermission#TRANSFER} for the target {@linkplain Workbasket}
* @throws InvalidArgumentException if the method parameters are empty or NULL * @throws InvalidArgumentException if the method parameters are empty or NULL
@ -523,7 +522,7 @@ public interface TaskService {
BulkOperationResults<String, TaskanaException> transferTasks( BulkOperationResults<String, TaskanaException> transferTasks(
String destinationWorkbasketId, List<String> taskIds, boolean setTransferFlag) String destinationWorkbasketId, List<String> taskIds, boolean setTransferFlag)
throws InvalidArgumentException, WorkbasketNotFoundException, throws InvalidArgumentException, WorkbasketNotFoundException,
MismatchedWorkbasketPermissionException; NotAuthorizedOnWorkbasketException;
/** /**
* Transfers a List of {@linkplain Task Tasks} to another {@linkplain Workbasket} while always * Transfers a List of {@linkplain Task Tasks} to another {@linkplain Workbasket} while always
@ -535,7 +534,7 @@ public interface TaskService {
default BulkOperationResults<String, TaskanaException> transferTasks( default BulkOperationResults<String, TaskanaException> transferTasks(
String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds) String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds)
throws InvalidArgumentException, WorkbasketNotFoundException, throws InvalidArgumentException, WorkbasketNotFoundException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
return transferTasks(destinationWorkbasketKey, destinationWorkbasketDomain, taskIds, true); return transferTasks(destinationWorkbasketKey, destinationWorkbasketDomain, taskIds, true);
} }
@ -554,7 +553,7 @@ public interface TaskService {
* @param setTransferFlag controls whether to set {@linkplain Task#isTransferred() isTransferred} * @param setTransferFlag controls whether to set {@linkplain Task#isTransferred() isTransferred}
* or not * or not
* @return BulkResult with {@linkplain Task#getId() ids} and Error for each failed transactions * @return BulkResult with {@linkplain Task#getId() ids} and Error for each failed transactions
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the source {@linkplain Workbasket} or no {@linkplain * WorkbasketPermission#READ} for the source {@linkplain Workbasket} or no {@linkplain
* WorkbasketPermission#TRANSFER} for the target {@linkplain Workbasket} * WorkbasketPermission#TRANSFER} for the target {@linkplain Workbasket}
* @throws InvalidArgumentException if the method parameters are empty or NULL * @throws InvalidArgumentException if the method parameters are empty or NULL
@ -566,7 +565,7 @@ public interface TaskService {
List<String> taskIds, List<String> taskIds,
boolean setTransferFlag) boolean setTransferFlag)
throws InvalidArgumentException, WorkbasketNotFoundException, throws InvalidArgumentException, WorkbasketNotFoundException,
MismatchedWorkbasketPermissionException; NotAuthorizedOnWorkbasketException;
/** /**
* Update a {@linkplain Task}. * Update a {@linkplain Task}.
@ -584,7 +583,7 @@ public interface TaskService {
* @throws ClassificationNotFoundException if the {@linkplain Task#getClassificationSummary() * @throws ClassificationNotFoundException if the {@linkplain Task#getClassificationSummary()
* classificationSummary} of the updated {@linkplain Task} refers to a {@link Classification} * classificationSummary} of the updated {@linkplain Task} refers to a {@link Classification}
* that can't be found * that can't be found
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
* @throws AttachmentPersistenceException if an {@linkplain Attachment} with the same {@linkplain * @throws AttachmentPersistenceException if an {@linkplain Attachment} with the same {@linkplain
* Attachment#getId() id} was added to the {@linkplain Task} multiple times without using * Attachment#getId() id} was added to the {@linkplain Task} multiple times without using
@ -599,7 +598,7 @@ public interface TaskService {
Task updateTask(Task task) Task updateTask(Task task)
throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException, throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException,
ClassificationNotFoundException, AttachmentPersistenceException, ClassificationNotFoundException, AttachmentPersistenceException,
ObjectReferencePersistenceException, MismatchedWorkbasketPermissionException, ObjectReferencePersistenceException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException; InvalidTaskStateException;
/** /**
@ -643,11 +642,11 @@ public interface TaskService {
* @param isRead the new status of {@linkplain Task#isRead() isRead} * @param isRead the new status of {@linkplain Task#isRead() isRead}
* @return the updated {@linkplain Task} * @return the updated {@linkplain Task}
* @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found * @throws TaskNotFoundException if the {@linkplain Task} with taskId wasn't found
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in * WorkbasketPermission#READ} for the {@linkplain Workbasket} the {@linkplain Task} is in
*/ */
Task setTaskRead(String taskId, boolean isRead) Task setTaskRead(String taskId, boolean isRead)
throws TaskNotFoundException, MismatchedWorkbasketPermissionException; throws TaskNotFoundException, NotAuthorizedOnWorkbasketException;
/** /**
* Sets the specified {@linkplain CallbackState} on a List of {@linkplain Task Tasks}. * Sets the specified {@linkplain CallbackState} on a List of {@linkplain Task Tasks}.
@ -705,21 +704,19 @@ public interface TaskService {
* Deletes the {@linkplain Task} with the given {@linkplain Task#getId() id}. * Deletes the {@linkplain Task} with the given {@linkplain Task#getId() id}.
* *
* @param taskId The {@linkplain Task#getId() id} of the {@linkplain Task} to delete * @param taskId The {@linkplain Task#getId() id} of the {@linkplain Task} to delete
* @throws MismatchedWorkbasketPermissionException If the current user doesn't have correct * @throws NotAuthorizedOnWorkbasketException If the current user doesn't have correct permission
* permission
* @throws TaskNotFoundException If the given {@linkplain Task#getId() id} doesn't refer to an * @throws TaskNotFoundException If the given {@linkplain Task#getId() id} doesn't refer to an
* existing {@linkplain Task} * existing {@linkplain Task}
* @throws InvalidTaskStateException If the {@linkplain Task#getState() state} of the referenced * @throws InvalidTaskStateException If the {@linkplain Task#getState() state} of the referenced
* {@linkplain Task} isn't one of the {@linkplain TaskState#END_STATES} * {@linkplain Task} isn't one of the {@linkplain TaskState#END_STATES}
* @throws MismatchedRoleException if the current user isn't member of {@linkplain * @throws NotAuthorizedException if the current user isn't member of {@linkplain
* TaskanaRole#ADMIN} * TaskanaRole#ADMIN}
* @throws InvalidCallbackStateException the Callback State of the Task is {@linkplain * @throws InvalidCallbackStateException the Callback State of the Task is {@linkplain
* CallbackState#CALLBACK_PROCESSING_REQUIRED} * CallbackState#CALLBACK_PROCESSING_REQUIRED}
*/ */
void deleteTask(String taskId) void deleteTask(String taskId)
throws TaskNotFoundException, MismatchedRoleException, throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException, InvalidTaskStateException, InvalidCallbackStateException;
InvalidCallbackStateException;
/** /**
* Deletes the {@linkplain Task} with the given {@linkplain Task#getId() id} even if it isn't * Deletes the {@linkplain Task} with the given {@linkplain Task#getId() id} even if it isn't
@ -731,17 +728,15 @@ public interface TaskService {
* @throws InvalidTaskStateException if the {@linkplain Task#getState() state} of the referenced * @throws InvalidTaskStateException if the {@linkplain Task#getState() state} of the referenced
* {@linkplain Task} isn't {@linkplain TaskState#TERMINATED} or {@linkplain * {@linkplain Task} isn't {@linkplain TaskState#TERMINATED} or {@linkplain
* TaskState#CANCELLED} * TaskState#CANCELLED}
* @throws MismatchedWorkbasketPermissionException If the current user doesn't have correct * @throws NotAuthorizedOnWorkbasketException If the current user doesn't have correct permissions
* permissions * @throws NotAuthorizedException if the current user isn't member of {@linkplain
* @throws MismatchedRoleException if the current user isn't member of {@linkplain
* TaskanaRole#ADMIN} * TaskanaRole#ADMIN}
* @throws InvalidCallbackStateException the Callback State of the Task is {@linkplain * @throws InvalidCallbackStateException the Callback State of the Task is {@linkplain
* CallbackState#CALLBACK_PROCESSING_REQUIRED} * CallbackState#CALLBACK_PROCESSING_REQUIRED}
*/ */
void forceDeleteTask(String taskId) void forceDeleteTask(String taskId)
throws TaskNotFoundException, MismatchedRoleException, throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException, InvalidTaskStateException, InvalidCallbackStateException;
InvalidCallbackStateException;
/** /**
* Deletes a List of {@linkplain Task Tasks}. * Deletes a List of {@linkplain Task Tasks}.
@ -750,11 +745,11 @@ public interface TaskService {
* @return the result of the operations with each {@linkplain Task#getId() id} and Exception for * @return the result of the operations with each {@linkplain Task#getId() id} and Exception for
* each failed deletion * each failed deletion
* @throws InvalidArgumentException if the tasks parameter contains NULL values * @throws InvalidArgumentException if the tasks parameter contains NULL values
* @throws MismatchedRoleException if the current user isn't member of {@linkplain * @throws NotAuthorizedException if the current user isn't member of {@linkplain
* TaskanaRole#ADMIN} * TaskanaRole#ADMIN}
*/ */
BulkOperationResults<String, TaskanaException> deleteTasks(List<String> tasks) BulkOperationResults<String, TaskanaException> deleteTasks(List<String> tasks)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
// endregion // endregion
@ -777,7 +772,7 @@ public interface TaskService {
* *
* @param taskComment the {@linkplain TaskComment} to be created * @param taskComment the {@linkplain TaskComment} to be created
* @return the created {@linkplain TaskComment} * @return the created {@linkplain TaskComment}
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} of the commented {@linkplain * WorkbasketPermission#READ} for the {@linkplain Workbasket} of the commented {@linkplain
* Task}. * Task}.
* @throws TaskNotFoundException if the given {@linkplain TaskComment#getTaskId() taskId} doesn't * @throws TaskNotFoundException if the given {@linkplain TaskComment#getTaskId() taskId} doesn't
@ -786,8 +781,7 @@ public interface TaskService {
* {@link TaskComment} is neither NULL nor empty * {@link TaskComment} is neither NULL nor empty
*/ */
TaskComment createTaskComment(TaskComment taskComment) TaskComment createTaskComment(TaskComment taskComment)
throws TaskNotFoundException, InvalidArgumentException, throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnWorkbasketException;
MismatchedWorkbasketPermissionException;
// endregion // endregion
@ -801,7 +795,7 @@ public interface TaskService {
* @return the {@linkplain TaskComment} identified by taskCommentId * @return the {@linkplain TaskComment} identified by taskCommentId
* @throws TaskCommentNotFoundException if the given taskCommentId doesn't refer to an existing * @throws TaskCommentNotFoundException if the given taskCommentId doesn't refer to an existing
* {@linkplain TaskComment} * {@linkplain TaskComment}
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} of the commented {@linkplain * WorkbasketPermission#READ} for the {@linkplain Workbasket} of the commented {@linkplain
* Task} * Task}
* @throws TaskNotFoundException if the {@linkplain TaskComment#getTaskId() taskId} of the * @throws TaskNotFoundException if the {@linkplain TaskComment#getTaskId() taskId} of the
@ -810,7 +804,7 @@ public interface TaskService {
*/ */
TaskComment getTaskComment(String taskCommentId) TaskComment getTaskComment(String taskCommentId)
throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException,
MismatchedWorkbasketPermissionException; NotAuthorizedOnWorkbasketException;
/** /**
* Retrieves the List of {@linkplain TaskComment TaskComments} for the {@linkplain Task} with * Retrieves the List of {@linkplain TaskComment TaskComments} for the {@linkplain Task} with
@ -820,14 +814,14 @@ public interface TaskService {
* {@linkplain TaskComment TaskComments} should be retrieved * {@linkplain TaskComment TaskComments} should be retrieved
* @return the List of {@linkplain TaskComment TaskComments} attached to the specified {@linkplain * @return the List of {@linkplain TaskComment TaskComments} attached to the specified {@linkplain
* Task} * Task}
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} of the commented {@linkplain * WorkbasketPermission#READ} for the {@linkplain Workbasket} of the commented {@linkplain
* Task} * Task}
* @throws TaskNotFoundException if the given taskId doesn't refer to an existing {@linkplain * @throws TaskNotFoundException if the given taskId doesn't refer to an existing {@linkplain
* Task} * Task}
*/ */
List<TaskComment> getTaskComments(String taskId) List<TaskComment> getTaskComments(String taskId)
throws TaskNotFoundException, MismatchedWorkbasketPermissionException; throws TaskNotFoundException, NotAuthorizedOnWorkbasketException;
// endregion // endregion
@ -838,7 +832,7 @@ public interface TaskService {
* *
* @param taskComment the {@linkplain TaskComment} to be updated in the database * @param taskComment the {@linkplain TaskComment} to be updated in the database
* @return the updated {@linkplain TaskComment} * @return the updated {@linkplain TaskComment}
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} of the commented {@linkplain * WorkbasketPermission#READ} for the {@linkplain Workbasket} of the commented {@linkplain
* Task}. * Task}.
* @throws ConcurrencyException if an attempt is made to update the {@linkplain TaskComment} and * @throws ConcurrencyException if an attempt is made to update the {@linkplain TaskComment} and
@ -850,13 +844,13 @@ public interface TaskService {
* to an existing {@linkplain Task} * to an existing {@linkplain Task}
* @throws InvalidArgumentException if the {@linkplain TaskComment#getId() id} of the specified * @throws InvalidArgumentException if the {@linkplain TaskComment#getId() id} of the specified
* {@linkplain TaskComment} is NULL or empty * {@linkplain TaskComment} is NULL or empty
* @throws MismatchedTaskCommentCreatorException If the current user doesn't have correct * @throws NotAuthorizedOnTaskCommentException If the current user doesn't have correct
* permissions * permissions
*/ */
TaskComment updateTaskComment(TaskComment taskComment) TaskComment updateTaskComment(TaskComment taskComment)
throws ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException, throws ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException,
InvalidArgumentException, MismatchedTaskCommentCreatorException, InvalidArgumentException, NotAuthorizedOnTaskCommentException,
MismatchedWorkbasketPermissionException; NotAuthorizedOnWorkbasketException;
// endregion // endregion
@ -873,15 +867,15 @@ public interface TaskService {
* @throws TaskNotFoundException if the {@linkplain TaskComment#getTaskId() taskId} of the * @throws TaskNotFoundException if the {@linkplain TaskComment#getTaskId() taskId} of the
* TaskComment doesn't refer to an existing {@linkplain Task} * TaskComment doesn't refer to an existing {@linkplain Task}
* @throws InvalidArgumentException if the given taskCommentId is NULL or empty * @throws InvalidArgumentException if the given taskCommentId is NULL or empty
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the {@linkplain Workbasket} the commented {@linkplain Task} * WorkbasketPermission#READ} for the {@linkplain Workbasket} the commented {@linkplain Task}
* is in * is in
* @throws MismatchedTaskCommentCreatorException if the current user is not the {@linkplain * @throws NotAuthorizedOnTaskCommentException if the current user is not the {@linkplain
* TaskComment#getCreator() creator} of the {@linkplain TaskComment}. * TaskComment#getCreator() creator} of the {@linkplain TaskComment}.
*/ */
void deleteTaskComment(String taskCommentId) void deleteTaskComment(String taskCommentId)
throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException,
MismatchedTaskCommentCreatorException, MismatchedWorkbasketPermissionException; NotAuthorizedOnTaskCommentException, NotAuthorizedOnWorkbasketException;
// endregion // endregion

View File

@ -9,13 +9,13 @@ import pro.taskana.task.api.models.TaskComment;
* This exception is thrown when the current user is not the creator of the {@linkplain TaskComment} * This exception is thrown when the current user is not the creator of the {@linkplain TaskComment}
* it tries to modify. * it tries to modify.
*/ */
public class MismatchedTaskCommentCreatorException extends TaskanaException { public class NotAuthorizedOnTaskCommentException extends TaskanaException {
public static final String ERROR_KEY = "TASK_COMMENT_CREATOR_MISMATCHED"; public static final String ERROR_KEY = "NOT_AUTHORIZED_ON_TASK_COMMENT";
private final String currentUserId; private final String currentUserId;
private final String taskCommentId; private final String taskCommentId;
public MismatchedTaskCommentCreatorException(String currentUserId, String taskCommentId) { public NotAuthorizedOnTaskCommentException(String currentUserId, String taskCommentId) {
super( super(
String.format( String.format(
"Not authorized. Current user '%s' is not the creator of TaskComment with id '%s'.", "Not authorized. Current user '%s' is not the creator of TaskComment with id '%s'.",

View File

@ -14,7 +14,7 @@ import pro.taskana.task.api.TaskCommentQuery;
import pro.taskana.task.api.TaskCommentQueryColumnName; import pro.taskana.task.api.TaskCommentQueryColumnName;
import pro.taskana.task.api.exceptions.TaskNotFoundException; import pro.taskana.task.api.exceptions.TaskNotFoundException;
import pro.taskana.task.api.models.TaskComment; import pro.taskana.task.api.models.TaskComment;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.NotAuthorizedToQueryWorkbasketException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedToQueryWorkbasketException;
import pro.taskana.workbasket.internal.WorkbasketQueryImpl; import pro.taskana.workbasket.internal.WorkbasketQueryImpl;
@ -307,7 +307,7 @@ public class TaskCommentQueryImpl implements TaskCommentQuery {
taskId -> { taskId -> {
try { try {
taskService.getTask(taskId); taskService.getTask(taskId);
} catch (MismatchedWorkbasketPermissionException e) { } catch (NotAuthorizedOnWorkbasketException e) {
throw new NotAuthorizedToQueryWorkbasketException( throw new NotAuthorizedToQueryWorkbasketException(
e.getMessage(), e.getErrorCode(), e); e.getMessage(), e.getErrorCode(), e);
} catch (TaskNotFoundException e) { } catch (TaskNotFoundException e) {

View File

@ -11,14 +11,14 @@ import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.common.internal.util.IdGenerator; import pro.taskana.common.internal.util.IdGenerator;
import pro.taskana.task.api.exceptions.MismatchedTaskCommentCreatorException; import pro.taskana.task.api.exceptions.NotAuthorizedOnTaskCommentException;
import pro.taskana.task.api.exceptions.TaskCommentNotFoundException; import pro.taskana.task.api.exceptions.TaskCommentNotFoundException;
import pro.taskana.task.api.exceptions.TaskNotFoundException; import pro.taskana.task.api.exceptions.TaskNotFoundException;
import pro.taskana.task.api.models.TaskComment; import pro.taskana.task.api.models.TaskComment;
import pro.taskana.task.internal.models.TaskCommentImpl; import pro.taskana.task.internal.models.TaskCommentImpl;
import pro.taskana.user.api.models.User; import pro.taskana.user.api.models.User;
import pro.taskana.user.internal.UserMapper; import pro.taskana.user.internal.UserMapper;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
class TaskCommentServiceImpl { class TaskCommentServiceImpl {
@ -50,8 +50,8 @@ class TaskCommentServiceImpl {
TaskComment updateTaskComment(TaskComment taskCommentToUpdate) TaskComment updateTaskComment(TaskComment taskCommentToUpdate)
throws ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException, throws ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException,
InvalidArgumentException, MismatchedTaskCommentCreatorException, InvalidArgumentException, NotAuthorizedOnTaskCommentException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid();
@ -82,7 +82,7 @@ class TaskCommentServiceImpl {
} }
} else { } else {
throw new MismatchedTaskCommentCreatorException(userId, taskCommentImplToUpdate.getId()); throw new NotAuthorizedOnTaskCommentException(userId, taskCommentImplToUpdate.getId());
} }
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
@ -92,8 +92,7 @@ class TaskCommentServiceImpl {
} }
TaskComment createTaskComment(TaskComment taskCommentToCreate) TaskComment createTaskComment(TaskComment taskCommentToCreate)
throws TaskNotFoundException, InvalidArgumentException, throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnWorkbasketException {
MismatchedWorkbasketPermissionException {
TaskCommentImpl taskCommentImplToCreate = (TaskCommentImpl) taskCommentToCreate; TaskCommentImpl taskCommentImplToCreate = (TaskCommentImpl) taskCommentToCreate;
@ -118,7 +117,7 @@ class TaskCommentServiceImpl {
void deleteTaskComment(String taskCommentId) void deleteTaskComment(String taskCommentId)
throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException,
MismatchedTaskCommentCreatorException, MismatchedWorkbasketPermissionException { NotAuthorizedOnTaskCommentException, NotAuthorizedOnWorkbasketException {
String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid();
@ -139,7 +138,7 @@ class TaskCommentServiceImpl {
} }
} else { } else {
throw new MismatchedTaskCommentCreatorException(userId, taskCommentToDelete.getId()); throw new NotAuthorizedOnTaskCommentException(userId, taskCommentToDelete.getId());
} }
} finally { } finally {
@ -148,7 +147,7 @@ class TaskCommentServiceImpl {
} }
List<TaskComment> getTaskComments(String taskId) List<TaskComment> getTaskComments(String taskId)
throws TaskNotFoundException, MismatchedWorkbasketPermissionException { throws TaskNotFoundException, NotAuthorizedOnWorkbasketException {
try { try {
@ -171,7 +170,7 @@ class TaskCommentServiceImpl {
TaskComment getTaskComment(String taskCommentId) TaskComment getTaskComment(String taskCommentId)
throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
TaskCommentImpl result; TaskCommentImpl result;

View File

@ -29,7 +29,7 @@ import pro.taskana.task.api.models.ObjectReference;
import pro.taskana.task.api.models.TaskSummary; import pro.taskana.task.api.models.TaskSummary;
import pro.taskana.task.internal.models.TaskSummaryImpl; import pro.taskana.task.internal.models.TaskSummaryImpl;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.NotAuthorizedToQueryWorkbasketException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedToQueryWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.internal.WorkbasketQueryImpl; import pro.taskana.workbasket.internal.WorkbasketQueryImpl;
@ -709,7 +709,6 @@ public class TaskQueryImpl implements TaskQuery {
return this; return this;
} }
@Override @Override
public TaskQuery classificationCategoryIn(String... classificationCategories) { public TaskQuery classificationCategoryIn(String... classificationCategories) {
this.classificationCategoryIn = classificationCategories; this.classificationCategoryIn = classificationCategories;
@ -2197,13 +2196,13 @@ public class TaskQueryImpl implements TaskQuery {
checkOpenAndReadPermissionByKeyDomain(keyDomain); checkOpenAndReadPermissionByKeyDomain(keyDomain);
} }
} }
} catch (MismatchedWorkbasketPermissionException e) { } catch (NotAuthorizedOnWorkbasketException e) {
throw new NotAuthorizedToQueryWorkbasketException(e.getMessage(), e.getErrorCode(), e); throw new NotAuthorizedToQueryWorkbasketException(e.getMessage(), e.getErrorCode(), e);
} }
} }
private void checkOpenAndReadPermissionById(String workbasketId) private void checkOpenAndReadPermissionById(String workbasketId)
throws MismatchedWorkbasketPermissionException { throws NotAuthorizedOnWorkbasketException {
try { try {
taskanaEngine taskanaEngine
.getEngine() .getEngine()
@ -2216,7 +2215,7 @@ public class TaskQueryImpl implements TaskQuery {
} }
private void checkOpenAndReadPermissionByKeyDomain(KeyDomain keyDomain) private void checkOpenAndReadPermissionByKeyDomain(KeyDomain keyDomain)
throws MismatchedWorkbasketPermissionException { throws NotAuthorizedOnWorkbasketException {
try { try {
taskanaEngine taskanaEngine
.getEngine() .getEngine()

View File

@ -31,7 +31,7 @@ import pro.taskana.common.api.BulkOperationResults;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.ConcurrencyException; import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.api.exceptions.TaskanaException; import pro.taskana.common.api.exceptions.TaskanaException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
@ -68,7 +68,7 @@ import pro.taskana.task.api.exceptions.AttachmentPersistenceException;
import pro.taskana.task.api.exceptions.InvalidCallbackStateException; import pro.taskana.task.api.exceptions.InvalidCallbackStateException;
import pro.taskana.task.api.exceptions.InvalidOwnerException; import pro.taskana.task.api.exceptions.InvalidOwnerException;
import pro.taskana.task.api.exceptions.InvalidTaskStateException; import pro.taskana.task.api.exceptions.InvalidTaskStateException;
import pro.taskana.task.api.exceptions.MismatchedTaskCommentCreatorException; import pro.taskana.task.api.exceptions.NotAuthorizedOnTaskCommentException;
import pro.taskana.task.api.exceptions.ObjectReferencePersistenceException; import pro.taskana.task.api.exceptions.ObjectReferencePersistenceException;
import pro.taskana.task.api.exceptions.TaskAlreadyExistException; import pro.taskana.task.api.exceptions.TaskAlreadyExistException;
import pro.taskana.task.api.exceptions.TaskCommentNotFoundException; import pro.taskana.task.api.exceptions.TaskCommentNotFoundException;
@ -90,7 +90,7 @@ import pro.taskana.user.api.models.User;
import pro.taskana.user.internal.UserMapper; import pro.taskana.user.internal.UserMapper;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.api.models.Workbasket; import pro.taskana.workbasket.api.models.Workbasket;
import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.api.models.WorkbasketSummary;
@ -157,28 +157,28 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public Task claim(String taskId) public Task claim(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
return claim(taskId, false); return claim(taskId, false);
} }
@Override @Override
public Task forceClaim(String taskId) public Task forceClaim(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
return claim(taskId, true); return claim(taskId, true);
} }
@Override @Override
public Task cancelClaim(String taskId) public Task cancelClaim(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
return this.cancelClaim(taskId, false); return this.cancelClaim(taskId, false);
} }
@Override @Override
public Task forceCancelClaim(String taskId) public Task forceCancelClaim(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
return this.cancelClaim(taskId, true); return this.cancelClaim(taskId, true);
} }
@ -186,41 +186,41 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public Task requestReview(String taskId) public Task requestReview(String taskId)
throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
return requestReview(taskId, false); return requestReview(taskId, false);
} }
@Override @Override
public Task forceRequestReview(String taskId) public Task forceRequestReview(String taskId)
throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
return requestReview(taskId, true); return requestReview(taskId, true);
} }
@Override @Override
public Task requestChanges(String taskId) public Task requestChanges(String taskId)
throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
return requestChanges(taskId, false); return requestChanges(taskId, false);
} }
@Override @Override
public Task forceRequestChanges(String taskId) public Task forceRequestChanges(String taskId)
throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
return requestChanges(taskId, true); return requestChanges(taskId, true);
} }
@Override @Override
public Task completeTask(String taskId) public Task completeTask(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
return completeTask(taskId, false); return completeTask(taskId, false);
} }
@Override @Override
public Task forceCompleteTask(String taskId) public Task forceCompleteTask(String taskId)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
return completeTask(taskId, true); return completeTask(taskId, true);
} }
@ -229,7 +229,7 @@ public class TaskServiceImpl implements TaskService {
public Task createTask(Task taskToCreate) public Task createTask(Task taskToCreate)
throws WorkbasketNotFoundException, ClassificationNotFoundException, throws WorkbasketNotFoundException, ClassificationNotFoundException,
TaskAlreadyExistException, InvalidArgumentException, AttachmentPersistenceException, TaskAlreadyExistException, InvalidArgumentException, AttachmentPersistenceException,
ObjectReferencePersistenceException, MismatchedWorkbasketPermissionException { ObjectReferencePersistenceException, NotAuthorizedOnWorkbasketException {
if (createTaskPreprocessorManager.isEnabled()) { if (createTaskPreprocessorManager.isEnabled()) {
taskToCreate = createTaskPreprocessorManager.processTaskBeforeCreation(taskToCreate); taskToCreate = createTaskPreprocessorManager.processTaskBeforeCreation(taskToCreate);
@ -347,8 +347,7 @@ public class TaskServiceImpl implements TaskService {
} }
@Override @Override
public Task getTask(String id) public Task getTask(String id) throws NotAuthorizedOnWorkbasketException, TaskNotFoundException {
throws MismatchedWorkbasketPermissionException, TaskNotFoundException {
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -359,7 +358,7 @@ public class TaskServiceImpl implements TaskService {
String workbasketId = resultTask.getWorkbasketSummary().getId(); String workbasketId = resultTask.getWorkbasketSummary().getId();
List<WorkbasketSummary> workbaskets = query.idIn(workbasketId).list(); List<WorkbasketSummary> workbaskets = query.idIn(workbasketId).list();
if (workbaskets.isEmpty()) { if (workbaskets.isEmpty()) {
throw new MismatchedWorkbasketPermissionException( throw new NotAuthorizedOnWorkbasketException(
taskanaEngine.getEngine().getCurrentUserContext().getUserid(), taskanaEngine.getEngine().getCurrentUserContext().getUserid(),
workbasketId, workbasketId,
WorkbasketPermission.READ); WorkbasketPermission.READ);
@ -410,21 +409,21 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public Task transfer(String taskId, String destinationWorkbasketId, boolean setTransferFlag) public Task transfer(String taskId, String destinationWorkbasketId, boolean setTransferFlag)
throws TaskNotFoundException, WorkbasketNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException { InvalidTaskStateException {
return taskTransferrer.transfer(taskId, destinationWorkbasketId, setTransferFlag); return taskTransferrer.transfer(taskId, destinationWorkbasketId, setTransferFlag);
} }
@Override @Override
public Task transfer(String taskId, String workbasketKey, String domain, boolean setTransferFlag) public Task transfer(String taskId, String workbasketKey, String domain, boolean setTransferFlag)
throws TaskNotFoundException, WorkbasketNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException { InvalidTaskStateException {
return taskTransferrer.transfer(taskId, workbasketKey, domain, setTransferFlag); return taskTransferrer.transfer(taskId, workbasketKey, domain, setTransferFlag);
} }
@Override @Override
public Task setTaskRead(String taskId, boolean isRead) public Task setTaskRead(String taskId, boolean isRead)
throws TaskNotFoundException, MismatchedWorkbasketPermissionException { throws TaskNotFoundException, NotAuthorizedOnWorkbasketException {
TaskImpl task; TaskImpl task;
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -501,7 +500,7 @@ public class TaskServiceImpl implements TaskService {
public Task updateTask(Task task) public Task updateTask(Task task)
throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException, throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException,
AttachmentPersistenceException, ObjectReferencePersistenceException, AttachmentPersistenceException, ObjectReferencePersistenceException,
ClassificationNotFoundException, MismatchedWorkbasketPermissionException, ClassificationNotFoundException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid();
TaskImpl newTaskImpl = (TaskImpl) task; TaskImpl newTaskImpl = (TaskImpl) task;
@ -551,7 +550,7 @@ public class TaskServiceImpl implements TaskService {
public BulkOperationResults<String, TaskanaException> transferTasks( public BulkOperationResults<String, TaskanaException> transferTasks(
String destinationWorkbasketId, List<String> taskIds, boolean setTransferFlag) String destinationWorkbasketId, List<String> taskIds, boolean setTransferFlag)
throws InvalidArgumentException, WorkbasketNotFoundException, throws InvalidArgumentException, WorkbasketNotFoundException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
return taskTransferrer.transfer(taskIds, destinationWorkbasketId, setTransferFlag); return taskTransferrer.transfer(taskIds, destinationWorkbasketId, setTransferFlag);
} }
@ -562,30 +561,28 @@ public class TaskServiceImpl implements TaskService {
List<String> taskIds, List<String> taskIds,
boolean setTransferFlag) boolean setTransferFlag)
throws InvalidArgumentException, WorkbasketNotFoundException, throws InvalidArgumentException, WorkbasketNotFoundException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
return taskTransferrer.transfer( return taskTransferrer.transfer(
taskIds, destinationWorkbasketKey, destinationWorkbasketDomain, setTransferFlag); taskIds, destinationWorkbasketKey, destinationWorkbasketDomain, setTransferFlag);
} }
@Override @Override
public void deleteTask(String taskId) public void deleteTask(String taskId)
throws TaskNotFoundException, MismatchedRoleException, throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException, InvalidTaskStateException, InvalidCallbackStateException {
InvalidCallbackStateException {
deleteTask(taskId, false); deleteTask(taskId, false);
} }
@Override @Override
public void forceDeleteTask(String taskId) public void forceDeleteTask(String taskId)
throws TaskNotFoundException, MismatchedRoleException, throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException, InvalidTaskStateException, InvalidCallbackStateException {
InvalidCallbackStateException {
deleteTask(taskId, true); deleteTask(taskId, true);
} }
@Override @Override
public Task selectAndClaim(TaskQuery taskQuery) public Task selectAndClaim(TaskQuery taskQuery)
throws InvalidOwnerException, MismatchedWorkbasketPermissionException { throws InvalidOwnerException, NotAuthorizedOnWorkbasketException {
try { try {
@ -612,7 +609,7 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public BulkOperationResults<String, TaskanaException> deleteTasks(List<String> taskIds) public BulkOperationResults<String, TaskanaException> deleteTasks(List<String> taskIds)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN);
@ -738,36 +735,35 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public TaskComment createTaskComment(TaskComment taskComment) public TaskComment createTaskComment(TaskComment taskComment)
throws TaskNotFoundException, InvalidArgumentException, throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnWorkbasketException {
MismatchedWorkbasketPermissionException {
return taskCommentService.createTaskComment(taskComment); return taskCommentService.createTaskComment(taskComment);
} }
@Override @Override
public TaskComment updateTaskComment(TaskComment taskComment) public TaskComment updateTaskComment(TaskComment taskComment)
throws ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException, throws ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException,
InvalidArgumentException, MismatchedTaskCommentCreatorException, InvalidArgumentException, NotAuthorizedOnTaskCommentException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
return taskCommentService.updateTaskComment(taskComment); return taskCommentService.updateTaskComment(taskComment);
} }
@Override @Override
public void deleteTaskComment(String taskCommentId) public void deleteTaskComment(String taskCommentId)
throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException,
MismatchedTaskCommentCreatorException, MismatchedWorkbasketPermissionException { NotAuthorizedOnTaskCommentException, NotAuthorizedOnWorkbasketException {
taskCommentService.deleteTaskComment(taskCommentId); taskCommentService.deleteTaskComment(taskCommentId);
} }
@Override @Override
public TaskComment getTaskComment(String taskCommentid) public TaskComment getTaskComment(String taskCommentid)
throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
return taskCommentService.getTaskComment(taskCommentid); return taskCommentService.getTaskComment(taskCommentid);
} }
@Override @Override
public List<TaskComment> getTaskComments(String taskId) public List<TaskComment> getTaskComments(String taskId)
throws TaskNotFoundException, MismatchedWorkbasketPermissionException { throws TaskNotFoundException, NotAuthorizedOnWorkbasketException {
return taskCommentService.getTaskComments(taskId); return taskCommentService.getTaskComments(taskId);
} }
@ -861,8 +857,7 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public Task cancelTask(String taskId) public Task cancelTask(String taskId)
throws TaskNotFoundException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException {
InvalidTaskStateException {
Task cancelledTask; Task cancelledTask;
@ -886,8 +881,8 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public Task terminateTask(String taskId) public Task terminateTask(String taskId)
throws TaskNotFoundException, MismatchedRoleException, throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException { InvalidTaskStateException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN, TaskanaRole.TASK_ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN, TaskanaRole.TASK_ADMIN);
@ -1004,7 +999,7 @@ public class TaskServiceImpl implements TaskService {
for (Pair<String, String> taskAndWorkbasketIds : taskAndWorkbasketIdsNotAuthorizedFor) { for (Pair<String, String> taskAndWorkbasketIds : taskAndWorkbasketIdsNotAuthorizedFor) {
bulkLog.addError( bulkLog.addError(
taskAndWorkbasketIds.getLeft(), taskAndWorkbasketIds.getLeft(),
new MismatchedWorkbasketPermissionException( new NotAuthorizedOnWorkbasketException(
userId, taskAndWorkbasketIds.getRight(), WorkbasketPermission.READ)); userId, taskAndWorkbasketIds.getRight(), WorkbasketPermission.READ));
} }
@ -1199,8 +1194,7 @@ public class TaskServiceImpl implements TaskService {
} }
private TaskImpl terminateCancelCommonActions(String taskId, TaskState targetState) private TaskImpl terminateCancelCommonActions(String taskId, TaskState targetState)
throws TaskNotFoundException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException {
InvalidTaskStateException {
if (taskId == null || taskId.isEmpty()) { if (taskId == null || taskId.isEmpty()) {
throw new TaskNotFoundException(taskId); throw new TaskNotFoundException(taskId);
} }
@ -1225,7 +1219,7 @@ public class TaskServiceImpl implements TaskService {
} }
private Task claim(String taskId, boolean forceClaim) private Task claim(String taskId, boolean forceClaim)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid();
String userLongName = null; String userLongName = null;
@ -1268,7 +1262,7 @@ public class TaskServiceImpl implements TaskService {
private Task requestReview(String taskId, boolean force) private Task requestReview(String taskId, boolean force)
throws TaskNotFoundException, InvalidTaskStateException, InvalidOwnerException, throws TaskNotFoundException, InvalidTaskStateException, InvalidOwnerException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid();
TaskImpl task; TaskImpl task;
try { try {
@ -1319,7 +1313,7 @@ public class TaskServiceImpl implements TaskService {
private Task requestChanges(String taskId, boolean force) private Task requestChanges(String taskId, boolean force)
throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid();
TaskImpl task; TaskImpl task;
try { try {
@ -1447,7 +1441,7 @@ public class TaskServiceImpl implements TaskService {
} }
private Task cancelClaim(String taskId, boolean forceUnclaim) private Task cancelClaim(String taskId, boolean forceUnclaim)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid();
TaskImpl task; TaskImpl task;
@ -1491,7 +1485,7 @@ public class TaskServiceImpl implements TaskService {
} }
private Task completeTask(String taskId, boolean isForced) private Task completeTask(String taskId, boolean isForced)
throws TaskNotFoundException, InvalidOwnerException, MismatchedWorkbasketPermissionException, throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid();
TaskImpl task; TaskImpl task;
@ -1534,9 +1528,8 @@ public class TaskServiceImpl implements TaskService {
} }
private void deleteTask(String taskId, boolean forceDelete) private void deleteTask(String taskId, boolean forceDelete)
throws TaskNotFoundException, MismatchedRoleException, throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException, InvalidTaskStateException, InvalidCallbackStateException {
InvalidCallbackStateException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN);
TaskImpl task; TaskImpl task;
try { try {

View File

@ -31,7 +31,7 @@ import pro.taskana.task.internal.models.TaskImpl;
import pro.taskana.task.internal.models.TaskSummaryImpl; import pro.taskana.task.internal.models.TaskSummaryImpl;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.api.models.WorkbasketSummary;
import pro.taskana.workbasket.internal.WorkbasketQueryImpl; import pro.taskana.workbasket.internal.WorkbasketQueryImpl;
@ -55,8 +55,8 @@ final class TaskTransferrer {
} }
Task transfer(String taskId, String destinationWorkbasketId, boolean setTransferFlag) Task transfer(String taskId, String destinationWorkbasketId, boolean setTransferFlag)
throws TaskNotFoundException, WorkbasketNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException { InvalidTaskStateException {
WorkbasketSummary destinationWorkbasket = WorkbasketSummary destinationWorkbasket =
workbasketService.getWorkbasket(destinationWorkbasketId).asSummary(); workbasketService.getWorkbasket(destinationWorkbasketId).asSummary();
return transferSingleTask(taskId, destinationWorkbasket, setTransferFlag); return transferSingleTask(taskId, destinationWorkbasket, setTransferFlag);
@ -67,8 +67,8 @@ final class TaskTransferrer {
String destinationWorkbasketKey, String destinationWorkbasketKey,
String destinationDomain, String destinationDomain,
boolean setTransferFlag) boolean setTransferFlag)
throws TaskNotFoundException, WorkbasketNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException { InvalidTaskStateException {
WorkbasketSummary destinationWorkbasket = WorkbasketSummary destinationWorkbasket =
workbasketService.getWorkbasket(destinationWorkbasketKey, destinationDomain).asSummary(); workbasketService.getWorkbasket(destinationWorkbasketKey, destinationDomain).asSummary();
return transferSingleTask(taskId, destinationWorkbasket, setTransferFlag); return transferSingleTask(taskId, destinationWorkbasket, setTransferFlag);
@ -77,7 +77,7 @@ final class TaskTransferrer {
BulkOperationResults<String, TaskanaException> transfer( BulkOperationResults<String, TaskanaException> transfer(
List<String> taskIds, String destinationWorkbasketId, boolean setTransferFlag) List<String> taskIds, String destinationWorkbasketId, boolean setTransferFlag)
throws WorkbasketNotFoundException, InvalidArgumentException, throws WorkbasketNotFoundException, InvalidArgumentException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
WorkbasketSummary destinationWorkbasket = WorkbasketSummary destinationWorkbasket =
workbasketService.getWorkbasket(destinationWorkbasketId).asSummary(); workbasketService.getWorkbasket(destinationWorkbasketId).asSummary();
checkDestinationWorkbasket(destinationWorkbasket); checkDestinationWorkbasket(destinationWorkbasket);
@ -91,7 +91,7 @@ final class TaskTransferrer {
String destinationDomain, String destinationDomain,
boolean setTransferFlag) boolean setTransferFlag)
throws WorkbasketNotFoundException, InvalidArgumentException, throws WorkbasketNotFoundException, InvalidArgumentException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
WorkbasketSummary destinationWorkbasket = WorkbasketSummary destinationWorkbasket =
workbasketService.getWorkbasket(destinationWorkbasketKey, destinationDomain).asSummary(); workbasketService.getWorkbasket(destinationWorkbasketKey, destinationDomain).asSummary();
checkDestinationWorkbasket(destinationWorkbasket); checkDestinationWorkbasket(destinationWorkbasket);
@ -101,8 +101,8 @@ final class TaskTransferrer {
private Task transferSingleTask( private Task transferSingleTask(
String taskId, WorkbasketSummary destinationWorkbasket, boolean setTransferFlag) String taskId, WorkbasketSummary destinationWorkbasket, boolean setTransferFlag)
throws TaskNotFoundException, WorkbasketNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException,
MismatchedWorkbasketPermissionException, InvalidTaskStateException { InvalidTaskStateException {
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
TaskImpl task = (TaskImpl) taskService.getTask(taskId); TaskImpl task = (TaskImpl) taskService.getTask(taskId);
@ -157,7 +157,7 @@ final class TaskTransferrer {
private void checkPreconditionsForTransferTask( private void checkPreconditionsForTransferTask(
Task task, WorkbasketSummary destinationWorkbasket, WorkbasketSummary originWorkbasket) Task task, WorkbasketSummary destinationWorkbasket, WorkbasketSummary originWorkbasket)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException, throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException,
InvalidTaskStateException { InvalidTaskStateException {
if (task.getState().isEndState()) { if (task.getState().isEndState()) {
throw new InvalidTaskStateException( throw new InvalidTaskStateException(
@ -168,7 +168,7 @@ final class TaskTransferrer {
} }
private void checkDestinationWorkbasket(WorkbasketSummary destinationWorkbasket) private void checkDestinationWorkbasket(WorkbasketSummary destinationWorkbasket)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException { throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException {
workbasketService.checkAuthorization( workbasketService.checkAuthorization(
destinationWorkbasket.getId(), WorkbasketPermission.APPEND); destinationWorkbasket.getId(), WorkbasketPermission.APPEND);
@ -215,7 +215,7 @@ final class TaskTransferrer {
taskId, taskSummary.getState(), EnumUtil.allValuesExceptFor(TaskState.END_STATES)); taskId, taskSummary.getState(), EnumUtil.allValuesExceptFor(TaskState.END_STATES));
} else if (!sourceWorkbasketIds.contains(taskSummary.getWorkbasketSummary().getId())) { } else if (!sourceWorkbasketIds.contains(taskSummary.getWorkbasketSummary().getId())) {
error = error =
new MismatchedWorkbasketPermissionException( new NotAuthorizedOnWorkbasketException(
taskanaEngine.getEngine().getCurrentUserContext().getUserid(), taskanaEngine.getEngine().getCurrentUserContext().getUserid(),
taskSummary.getWorkbasketSummary().getId(), taskSummary.getWorkbasketSummary().getId(),
WorkbasketPermission.TRANSFER); WorkbasketPermission.TRANSFER);

View File

@ -18,7 +18,7 @@ import pro.taskana.common.api.ScheduledJob;
import pro.taskana.common.api.TaskanaEngine; import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.api.TimeInterval; import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.api.exceptions.TaskanaException; import pro.taskana.common.api.exceptions.TaskanaException;
import pro.taskana.common.internal.jobs.AbstractTaskanaJob; import pro.taskana.common.internal.jobs.AbstractTaskanaJob;
@ -132,7 +132,7 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
} }
private int deleteTasks(List<TaskSummary> tasksToBeDeleted) private int deleteTasks(List<TaskSummary> tasksToBeDeleted)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
List<String> tasksIdsToBeDeleted = List<String> tasksIdsToBeDeleted =
tasksToBeDeleted.stream().map(TaskSummary::getId).collect(Collectors.toList()); tasksToBeDeleted.stream().map(TaskSummary::getId).collect(Collectors.toList());

View File

@ -4,7 +4,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.user.api.exceptions.UserAlreadyExistException; import pro.taskana.user.api.exceptions.UserAlreadyExistException;
import pro.taskana.user.api.exceptions.UserNotFoundException; import pro.taskana.user.api.exceptions.UserNotFoundException;
import pro.taskana.user.api.models.User; import pro.taskana.user.api.models.User;
@ -41,14 +41,14 @@ public interface UserService {
* @param userToCreate the {@linkplain User} which should be inserted * @param userToCreate the {@linkplain User} which should be inserted
* @return the inserted {@linkplain User} * @return the inserted {@linkplain User}
* @throws InvalidArgumentException if some fields are not set properly * @throws InvalidArgumentException if some fields are not set properly
* @throws MismatchedRoleException if the current user is not {@linkplain * @throws NotAuthorizedException if the current user is not {@linkplain
* pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
* pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin} * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
* @throws UserAlreadyExistException if there already exists a {@linkplain User} with the * @throws UserAlreadyExistException if there already exists a {@linkplain User} with the
* specified {@linkplain User#getId() id} inside the database * specified {@linkplain User#getId() id} inside the database
*/ */
User createUser(User userToCreate) User createUser(User userToCreate)
throws InvalidArgumentException, UserAlreadyExistException, MismatchedRoleException; throws InvalidArgumentException, UserAlreadyExistException, NotAuthorizedException;
/** /**
* Gets a {@linkplain User}. * Gets a {@linkplain User}.
@ -85,7 +85,7 @@ public interface UserService {
* *
* @param userToUpdate the {@linkplain User} which should be updated * @param userToUpdate the {@linkplain User} which should be updated
* @return the updated {@linkplain User} * @return the updated {@linkplain User}
* @throws MismatchedRoleException if the current user is not {@linkplain * @throws NotAuthorizedException if the current user is not {@linkplain
* pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
* pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin} * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
* @throws UserNotFoundException if there does not exist a {@linkplain User} with the specified * @throws UserNotFoundException if there does not exist a {@linkplain User} with the specified
@ -93,7 +93,7 @@ public interface UserService {
* @throws InvalidArgumentException if some fields are not set properly * @throws InvalidArgumentException if some fields are not set properly
*/ */
User updateUser(User userToUpdate) User updateUser(User userToUpdate)
throws UserNotFoundException, InvalidArgumentException, MismatchedRoleException; throws UserNotFoundException, InvalidArgumentException, NotAuthorizedException;
/** /**
* Deletes a {@linkplain User}. * Deletes a {@linkplain User}.
@ -103,7 +103,7 @@ public interface UserService {
* gets deleted. * gets deleted.
* *
* @param id the {@linkplain User#getId() id} of the {@linkplain User} which should be deleted * @param id the {@linkplain User#getId() id} of the {@linkplain User} which should be deleted
* @throws MismatchedRoleException if the current user is not {@linkplain * @throws NotAuthorizedException if the current user is not {@linkplain
* pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
* pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin} * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
* @throws UserNotFoundException if there does not exist a {@linkplain User} with the specified * @throws UserNotFoundException if there does not exist a {@linkplain User} with the specified
@ -111,5 +111,5 @@ public interface UserService {
* @throws InvalidArgumentException if the userIds parameter is NULL or empty * @throws InvalidArgumentException if the userIds parameter is NULL or empty
*/ */
void deleteUser(String id) void deleteUser(String id)
throws UserNotFoundException, InvalidArgumentException, MismatchedRoleException; throws UserNotFoundException, InvalidArgumentException, NotAuthorizedException;
} }

View File

@ -15,7 +15,7 @@ import pro.taskana.TaskanaConfiguration;
import pro.taskana.common.api.BaseQuery.SortDirection; import pro.taskana.common.api.BaseQuery.SortDirection;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.user.api.UserService; import pro.taskana.user.api.UserService;
import pro.taskana.user.api.exceptions.UserAlreadyExistException; import pro.taskana.user.api.exceptions.UserAlreadyExistException;
@ -90,7 +90,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public User createUser(User userToCreate) public User createUser(User userToCreate)
throws InvalidArgumentException, UserAlreadyExistException, MismatchedRoleException { throws InvalidArgumentException, UserAlreadyExistException, NotAuthorizedException {
internalTaskanaEngine internalTaskanaEngine
.getEngine() .getEngine()
.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); .checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
@ -107,7 +107,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public User updateUser(User userToUpdate) public User updateUser(User userToUpdate)
throws UserNotFoundException, InvalidArgumentException, MismatchedRoleException { throws UserNotFoundException, InvalidArgumentException, NotAuthorizedException {
internalTaskanaEngine internalTaskanaEngine
.getEngine() .getEngine()
.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); .checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
@ -132,7 +132,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public void deleteUser(String id) public void deleteUser(String id)
throws UserNotFoundException, InvalidArgumentException, MismatchedRoleException { throws UserNotFoundException, InvalidArgumentException, NotAuthorizedException {
internalTaskanaEngine internalTaskanaEngine
.getEngine() .getEngine()
.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); .checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);

View File

@ -6,7 +6,7 @@ import pro.taskana.common.api.BaseQuery;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.TimeInterval; import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.api.models.WorkbasketSummary;
/** WorkitemQuery for generating dynamic sql. */ /** WorkitemQuery for generating dynamic sql. */
@ -152,12 +152,12 @@ public interface WorkbasketQuery extends BaseQuery<WorkbasketSummary, Workbasket
* @param accessIds Users which should be checked for given permissions on workbaskets. * @param accessIds Users which should be checked for given permissions on workbaskets.
* @return the current query object. * @return the current query object.
* @throws InvalidArgumentException if permissions OR the accessIds are NULL or empty. * @throws InvalidArgumentException if permissions OR the accessIds are NULL or empty.
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
*/ */
WorkbasketQuery accessIdsHavePermissions( WorkbasketQuery accessIdsHavePermissions(
List<WorkbasketPermission> permissions, String... accessIds) List<WorkbasketPermission> permissions, String... accessIds)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
/** /**
* Add condition to query if the caller (one of the accessIds of the caller) has the given * Add condition to query if the caller (one of the accessIds of the caller) has the given

View File

@ -7,10 +7,10 @@ import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.ConcurrencyException; import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.DomainNotFoundException; import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.TaskanaException; import pro.taskana.common.api.exceptions.TaskanaException;
import pro.taskana.user.api.models.User; import pro.taskana.user.api.models.User;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketAccessItemAlreadyExistException; import pro.taskana.workbasket.api.exceptions.WorkbasketAccessItemAlreadyExistException;
import pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException; import pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException;
import pro.taskana.workbasket.api.exceptions.WorkbasketInUseException; import pro.taskana.workbasket.api.exceptions.WorkbasketInUseException;
@ -49,7 +49,7 @@ public interface WorkbasketService {
* @return the created and inserted {@linkplain Workbasket} * @return the created and inserted {@linkplain Workbasket}
* @throws InvalidArgumentException If a required property of the {@linkplain Workbasket} is not * @throws InvalidArgumentException If a required property of the {@linkplain Workbasket} is not
* set. * set.
* @throws MismatchedRoleException if the current user is not member of role {@linkplain * @throws NotAuthorizedException if the current user is not member of role {@linkplain
* pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
* pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin} * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
* @throws WorkbasketAlreadyExistException if the {@linkplain Workbasket} exists already * @throws WorkbasketAlreadyExistException if the {@linkplain Workbasket} exists already
@ -58,7 +58,7 @@ public interface WorkbasketService {
*/ */
Workbasket createWorkbasket(Workbasket workbasket) Workbasket createWorkbasket(Workbasket workbasket)
throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException, throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException,
MismatchedRoleException; NotAuthorizedException;
// READ // READ
@ -71,11 +71,11 @@ public interface WorkbasketService {
* @return the requested Workbasket * @return the requested Workbasket
* @throws WorkbasketNotFoundException If the {@linkplain Workbasket} with workbasketId is not * @throws WorkbasketNotFoundException If the {@linkplain Workbasket} with workbasketId is not
* found * found
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the requested {@linkplain Workbasket} * WorkbasketPermission#READ} for the requested {@linkplain Workbasket}
*/ */
Workbasket getWorkbasket(String workbasketId) Workbasket getWorkbasket(String workbasketId)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException; throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException;
/** /**
* Get the {@linkplain Workbasket} specified by the given {@linkplain WorkbasketSummary#getKey() * Get the {@linkplain Workbasket} specified by the given {@linkplain WorkbasketSummary#getKey()
@ -88,11 +88,11 @@ public interface WorkbasketService {
* @return the requested {@linkplain Workbasket} * @return the requested {@linkplain Workbasket}
* @throws WorkbasketNotFoundException If the {@linkplain Workbasket} with workbasketId is not * @throws WorkbasketNotFoundException If the {@linkplain Workbasket} with workbasketId is not
* found * found
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ} for the requested {@linkplain Workbasket} * WorkbasketPermission#READ} for the requested {@linkplain Workbasket}
*/ */
Workbasket getWorkbasket(String workbasketKey, String domain) Workbasket getWorkbasket(String workbasketKey, String domain)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException; throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException;
// UPDATE // UPDATE
@ -103,8 +103,8 @@ public interface WorkbasketService {
* @return the updated {@linkplain Workbasket} * @return the updated {@linkplain Workbasket}
* @throws InvalidArgumentException if {@linkplain Workbasket#getName() name} or {@linkplain * @throws InvalidArgumentException if {@linkplain Workbasket#getName() name} or {@linkplain
* Workbasket#getType() type} of the {@linkplain Workbasket} is invalid * Workbasket#getType() type} of the {@linkplain Workbasket} is invalid
* @throws MismatchedWorkbasketPermissionException This is never thrown * @throws NotAuthorizedOnWorkbasketException This is never thrown
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
* @throws WorkbasketNotFoundException if the {@linkplain Workbasket} cannot be found. * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} cannot be found.
* @throws ConcurrencyException if an attempt is made to update the {@linkplain Workbasket} and * @throws ConcurrencyException if an attempt is made to update the {@linkplain Workbasket} and
@ -113,7 +113,7 @@ public interface WorkbasketService {
*/ */
Workbasket updateWorkbasket(Workbasket workbasket) Workbasket updateWorkbasket(Workbasket workbasket)
throws InvalidArgumentException, WorkbasketNotFoundException, ConcurrencyException, throws InvalidArgumentException, WorkbasketNotFoundException, ConcurrencyException,
MismatchedRoleException, MismatchedWorkbasketPermissionException; NotAuthorizedException, NotAuthorizedOnWorkbasketException;
// DELETE // DELETE
@ -124,8 +124,8 @@ public interface WorkbasketService {
* should be deleted. * should be deleted.
* @return true if the {@linkplain Workbasket} was deleted successfully; false if the {@linkplain * @return true if the {@linkplain Workbasket} was deleted successfully; false if the {@linkplain
* Workbasket} is marked for deletion * Workbasket} is marked for deletion
* @throws MismatchedWorkbasketPermissionException This is never thrown * @throws NotAuthorizedOnWorkbasketException This is never thrown
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
* @throws WorkbasketNotFoundException if the {@linkplain Workbasket} does not exist * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} does not exist
* @throws WorkbasketInUseException if the {@linkplain Workbasket} does contain task-content * @throws WorkbasketInUseException if the {@linkplain Workbasket} does contain task-content
@ -133,7 +133,7 @@ public interface WorkbasketService {
*/ */
boolean deleteWorkbasket(String workbasketId) boolean deleteWorkbasket(String workbasketId)
throws WorkbasketNotFoundException, WorkbasketInUseException, InvalidArgumentException, throws WorkbasketNotFoundException, WorkbasketInUseException, InvalidArgumentException,
MismatchedRoleException, MismatchedWorkbasketPermissionException; NotAuthorizedException, NotAuthorizedOnWorkbasketException;
/** /**
* Deletes the list of {@linkplain Workbasket}s specified via {@linkplain Workbasket#getId() ids}. * Deletes the list of {@linkplain Workbasket}s specified via {@linkplain Workbasket#getId() ids}.
@ -142,11 +142,11 @@ public interface WorkbasketService {
* to delete. * to delete.
* @return the result of the operations and an Exception for each failed workbasket deletion * @return the result of the operations and an Exception for each failed workbasket deletion
* @throws InvalidArgumentException if the WorkbasketIds parameter List is NULL or empty * @throws InvalidArgumentException if the WorkbasketIds parameter List is NULL or empty
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
*/ */
BulkOperationResults<String, TaskanaException> deleteWorkbaskets(List<String> workbasketsIds) BulkOperationResults<String, TaskanaException> deleteWorkbaskets(List<String> workbasketsIds)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
// endregion // endregion
@ -160,15 +160,15 @@ public interface WorkbasketService {
* @param sourceWorkbasketId the {@linkplain Workbasket#getId() id} of the source {@linkplain * @param sourceWorkbasketId the {@linkplain Workbasket#getId() id} of the source {@linkplain
* Workbasket} for which the distribution targets are to be set * Workbasket} for which the distribution targets are to be set
* @param targetWorkbasketIds a list of the ids of the target {@linkplain Workbasket}s * @param targetWorkbasketIds a list of the ids of the target {@linkplain Workbasket}s
* @throws MismatchedWorkbasketPermissionException This is never thrown * @throws NotAuthorizedOnWorkbasketException This is never thrown
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
* @throws WorkbasketNotFoundException if either the source {@linkplain Workbasket} or any of the * @throws WorkbasketNotFoundException if either the source {@linkplain Workbasket} or any of the
* target {@linkplain Workbasket}s don't exist * target {@linkplain Workbasket}s don't exist
*/ */
void setDistributionTargets(String sourceWorkbasketId, List<String> targetWorkbasketIds) void setDistributionTargets(String sourceWorkbasketId, List<String> targetWorkbasketIds)
throws WorkbasketNotFoundException, MismatchedRoleException, throws WorkbasketNotFoundException, NotAuthorizedException,
MismatchedWorkbasketPermissionException; NotAuthorizedOnWorkbasketException;
// READ // READ
@ -178,12 +178,12 @@ public interface WorkbasketService {
* @param workbasketId the {@linkplain Workbasket#getId() id} of the referenced {@linkplain * @param workbasketId the {@linkplain Workbasket#getId() id} of the referenced {@linkplain
* Workbasket} * Workbasket}
* @return the distribution targets of the specified {@linkplain Workbasket} * @return the distribution targets of the specified {@linkplain Workbasket}
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ READ permission} for the specified {@linkplain Workbasket} * WorkbasketPermission#READ READ permission} for the specified {@linkplain Workbasket}
* @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
*/ */
List<WorkbasketSummary> getDistributionTargets(String workbasketId) List<WorkbasketSummary> getDistributionTargets(String workbasketId)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException; throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException;
/** /**
* Returns the distribution targets for a given {@linkplain Workbasket}. * Returns the distribution targets for a given {@linkplain Workbasket}.
@ -193,12 +193,12 @@ public interface WorkbasketService {
* @param domain the {@linkplain Workbasket#getDomain() domain} of the referenced {@linkplain * @param domain the {@linkplain Workbasket#getDomain() domain} of the referenced {@linkplain
* Workbasket} * Workbasket}
* @return the distribution targets of the specified {@linkplain Workbasket} * @return the distribution targets of the specified {@linkplain Workbasket}
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ READ permission} for the specified {@linkplain Workbasket} * WorkbasketPermission#READ READ permission} for the specified {@linkplain Workbasket}
* @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
*/ */
List<WorkbasketSummary> getDistributionTargets(String workbasketKey, String domain) List<WorkbasketSummary> getDistributionTargets(String workbasketKey, String domain)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException; throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException;
/** /**
* Returns the distribution sources for a given {@linkplain Workbasket}. * Returns the distribution sources for a given {@linkplain Workbasket}.
@ -206,12 +206,12 @@ public interface WorkbasketService {
* @param workbasketId the {@linkplain Workbasket#getId() id} of the referenced {@linkplain * @param workbasketId the {@linkplain Workbasket#getId() id} of the referenced {@linkplain
* Workbasket} * Workbasket}
* @return the workbaskets that are distribution sources of the specified {@linkplain Workbasket}. * @return the workbaskets that are distribution sources of the specified {@linkplain Workbasket}.
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ READ permission} for the specified {@linkplain Workbasket} * WorkbasketPermission#READ READ permission} for the specified {@linkplain Workbasket}
* @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
*/ */
List<WorkbasketSummary> getDistributionSources(String workbasketId) List<WorkbasketSummary> getDistributionSources(String workbasketId)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException; throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException;
/** /**
* Returns the distribution sources for a given {@linkplain Workbasket}. * Returns the distribution sources for a given {@linkplain Workbasket}.
@ -221,12 +221,12 @@ public interface WorkbasketService {
* @param domain the {@linkplain Workbasket#getDomain() domain} of the referenced {@linkplain * @param domain the {@linkplain Workbasket#getDomain() domain} of the referenced {@linkplain
* Workbasket} * Workbasket}
* @return the workbaskets that are distribution sources of the specified {@linkplain Workbasket}. * @return the workbaskets that are distribution sources of the specified {@linkplain Workbasket}.
* @throws MismatchedWorkbasketPermissionException if the current user has no {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user has no {@linkplain
* WorkbasketPermission#READ READ permission} for the specified {@linkplain Workbasket} * WorkbasketPermission#READ READ permission} for the specified {@linkplain Workbasket}
* @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
*/ */
List<WorkbasketSummary> getDistributionSources(String workbasketKey, String domain) List<WorkbasketSummary> getDistributionSources(String workbasketKey, String domain)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException; throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException;
// UPDATE // UPDATE
@ -238,16 +238,16 @@ public interface WorkbasketService {
* Workbasket} * Workbasket}
* @param targetWorkbasketId the {@linkplain Workbasket#getId() id} of the target {@linkplain * @param targetWorkbasketId the {@linkplain Workbasket#getId() id} of the target {@linkplain
* Workbasket} * Workbasket}
* @throws MismatchedWorkbasketPermissionException if the current user doesn't have {@linkplain * @throws NotAuthorizedOnWorkbasketException if the current user doesn't have {@linkplain
* WorkbasketPermission#READ READ permission} for the source {@linkplain Workbasket}s * WorkbasketPermission#READ READ permission} for the source {@linkplain Workbasket}s
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
* @throws WorkbasketNotFoundException if either the source {@linkplain Workbasket} or the target * @throws WorkbasketNotFoundException if either the source {@linkplain Workbasket} or the target
* {@linkplain Workbasket} doesn't exist * {@linkplain Workbasket} doesn't exist
*/ */
void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
throws WorkbasketNotFoundException, MismatchedRoleException, throws WorkbasketNotFoundException, NotAuthorizedException,
MismatchedWorkbasketPermissionException; NotAuthorizedOnWorkbasketException;
// DELETE // DELETE
@ -259,13 +259,13 @@ public interface WorkbasketService {
* Workbasket} * Workbasket}
* @param targetWorkbasketId The {@linkplain Workbasket#getId() id} of the target {@linkplain * @param targetWorkbasketId The {@linkplain Workbasket#getId() id} of the target {@linkplain
* Workbasket} * Workbasket}
* @throws MismatchedWorkbasketPermissionException If the current user doesn't have {@linkplain * @throws NotAuthorizedOnWorkbasketException If the current user doesn't have {@linkplain
* WorkbasketPermission#READ READ permission} for the source {@linkplain Workbasket} * WorkbasketPermission#READ READ permission} for the source {@linkplain Workbasket}
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
*/ */
void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
throws MismatchedRoleException, MismatchedWorkbasketPermissionException; throws NotAuthorizedException, NotAuthorizedOnWorkbasketException;
// endregion // endregion
@ -292,7 +292,7 @@ public interface WorkbasketService {
* @param workbasketAccessItem the new {@linkplain WorkbasketAccessItem} * @param workbasketAccessItem the new {@linkplain WorkbasketAccessItem}
* @return the created {@linkplain WorkbasketAccessItem} * @return the created {@linkplain WorkbasketAccessItem}
* @throws InvalidArgumentException if the preconditions don't match the required ones. * @throws InvalidArgumentException if the preconditions don't match the required ones.
* @throws MismatchedRoleException if the current user is not member of role {@linkplain * @throws NotAuthorizedException if the current user is not member of role {@linkplain
* pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
* pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin} * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
* @throws WorkbasketNotFoundException if the {@linkplain WorkbasketAccessItem} refers to a not * @throws WorkbasketNotFoundException if the {@linkplain WorkbasketAccessItem} refers to a not
@ -303,7 +303,7 @@ public interface WorkbasketService {
*/ */
WorkbasketAccessItem createWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) WorkbasketAccessItem createWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
throws InvalidArgumentException, WorkbasketNotFoundException, throws InvalidArgumentException, WorkbasketNotFoundException,
WorkbasketAccessItemAlreadyExistException, MismatchedRoleException; WorkbasketAccessItemAlreadyExistException, NotAuthorizedException;
/** /**
* Setting up the new {@linkplain WorkbasketAccessItem}s for a {@linkplain Workbasket}. Already * Setting up the new {@linkplain WorkbasketAccessItem}s for a {@linkplain Workbasket}. Already
@ -323,9 +323,9 @@ public interface WorkbasketService {
* stored ones. * stored ones.
* @throws InvalidArgumentException will be thrown when the parameter {@code wbAccessItems} is * @throws InvalidArgumentException will be thrown when the parameter {@code wbAccessItems} is
* NULL or member doesn't match the preconditions * NULL or member doesn't match the preconditions
* @throws MismatchedRoleException if the current user is not member of {@linkplain * @throws NotAuthorizedException if the current user is not member of {@linkplain
* TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN} * TaskanaRole#BUSINESS_ADMIN} or {@linkplain TaskanaRole#ADMIN}
* @throws MismatchedWorkbasketPermissionException This is never thrown * @throws NotAuthorizedOnWorkbasketException This is never thrown
* @throws WorkbasketAccessItemAlreadyExistException if {@code wbAccessItems} contains multiple * @throws WorkbasketAccessItemAlreadyExistException if {@code wbAccessItems} contains multiple
* {@linkplain WorkbasketAccessItem} with the same {@linkplain * {@linkplain WorkbasketAccessItem} with the same {@linkplain
* WorkbasketAccessItem#getAccessId() accessId}. * WorkbasketAccessItem#getAccessId() accessId}.
@ -334,8 +334,7 @@ public interface WorkbasketService {
*/ */
void setWorkbasketAccessItems(String workbasketId, List<WorkbasketAccessItem> wbAccessItems) void setWorkbasketAccessItems(String workbasketId, List<WorkbasketAccessItem> wbAccessItems)
throws InvalidArgumentException, WorkbasketAccessItemAlreadyExistException, throws InvalidArgumentException, WorkbasketAccessItemAlreadyExistException,
WorkbasketNotFoundException, MismatchedRoleException, WorkbasketNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException;
MismatchedWorkbasketPermissionException;
// READ // READ
@ -344,12 +343,12 @@ public interface WorkbasketService {
* *
* @param workbasketId the {@linkplain Workbasket#getId() id} of the {@linkplain Workbasket} * @param workbasketId the {@linkplain Workbasket#getId() id} of the {@linkplain Workbasket}
* @return List of {@linkplain WorkbasketAccessItem}s for the {@linkplain Workbasket} * @return List of {@linkplain WorkbasketAccessItem}s for the {@linkplain Workbasket}
* @throws MismatchedRoleException if the current user is not member of role {@linkplain * @throws NotAuthorizedException if the current user is not member of role {@linkplain
* pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN} or {@linkplain * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN} or {@linkplain
* pro.taskana.common.api.TaskanaRole#ADMIN} * pro.taskana.common.api.TaskanaRole#ADMIN}
*/ */
List<WorkbasketAccessItem> getWorkbasketAccessItems(String workbasketId) List<WorkbasketAccessItem> getWorkbasketAccessItems(String workbasketId)
throws MismatchedRoleException; throws NotAuthorizedException;
// UPDATE // UPDATE
@ -361,12 +360,12 @@ public interface WorkbasketService {
* @throws InvalidArgumentException if {@linkplain WorkbasketAccessItem#getAccessId() accessId} or * @throws InvalidArgumentException if {@linkplain WorkbasketAccessItem#getAccessId() accessId} or
* {@linkplain WorkbasketAccessItem#getWorkbasketId() workbasketId} is changed in the * {@linkplain WorkbasketAccessItem#getWorkbasketId() workbasketId} is changed in the
* {@linkplain WorkbasketAccessItem} * {@linkplain WorkbasketAccessItem}
* @throws MismatchedRoleException if the current user is not member of role {@linkplain * @throws NotAuthorizedException if the current user is not member of role {@linkplain
* pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
* pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin} * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
*/ */
WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
throws InvalidArgumentException, MismatchedRoleException; throws InvalidArgumentException, NotAuthorizedException;
// DELETE // DELETE
@ -375,22 +374,22 @@ public interface WorkbasketService {
* *
* @param id the {@linkplain WorkbasketAccessItem#getId() id} of the {@linkplain * @param id the {@linkplain WorkbasketAccessItem#getId() id} of the {@linkplain
* WorkbasketAccessItem} to be deleted * WorkbasketAccessItem} to be deleted
* @throws MismatchedRoleException if the current user is not member of role {@linkplain * @throws NotAuthorizedException if the current user is not member of role {@linkplain
* pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
* pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin} * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
*/ */
void deleteWorkbasketAccessItem(String id) throws MismatchedRoleException; void deleteWorkbasketAccessItem(String id) throws NotAuthorizedException;
/** /**
* Deletes all {@linkplain WorkbasketAccessItem}s using the given {@linkplain * Deletes all {@linkplain WorkbasketAccessItem}s using the given {@linkplain
* WorkbasketAccessItem#getAccessId()}. * WorkbasketAccessItem#getAccessId()}.
* *
* @param accessId {@linkplain User#getId() id} of a taskana-{@linkplain User}. * @param accessId {@linkplain User#getId() id} of a taskana-{@linkplain User}.
* @throws MismatchedRoleException if the current user is not member of role {@linkplain * @throws NotAuthorizedException if the current user is not member of role {@linkplain
* pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
* pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin} * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
*/ */
void deleteWorkbasketAccessItemsForAccessId(String accessId) throws MismatchedRoleException; void deleteWorkbasketAccessItemsForAccessId(String accessId) throws NotAuthorizedException;
// endregion // endregion
@ -406,11 +405,11 @@ public interface WorkbasketService {
* This method provides a query builder for querying the database. * This method provides a query builder for querying the database.
* *
* @return a {@linkplain WorkbasketAccessItemQuery} * @return a {@linkplain WorkbasketAccessItemQuery}
* @throws MismatchedRoleException if the current user is not member of role {@linkplain * @throws NotAuthorizedException if the current user is not member of role {@linkplain
* pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
* pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin} * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
*/ */
WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws MismatchedRoleException; WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws NotAuthorizedException;
// endregion // endregion
// region Permission and Authorization // region Permission and Authorization
@ -437,13 +436,13 @@ public interface WorkbasketService {
* want to access * want to access
* @param permission the needed {@linkplain WorkbasketPermission}; if more than one {@linkplain * @param permission the needed {@linkplain WorkbasketPermission}; if more than one {@linkplain
* WorkbasketPermission permission} is specified, the current user needs all of them * WorkbasketPermission permission} is specified, the current user needs all of them
* @throws MismatchedWorkbasketPermissionException if the current user has not the requested * @throws NotAuthorizedOnWorkbasketException if the current user has not the requested
* authorization for the specified {@linkplain Workbasket} * authorization for the specified {@linkplain Workbasket}
* @throws WorkbasketNotFoundException if the {@linkplain Workbasket} cannot be found for the * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} cannot be found for the
* given {@linkplain Workbasket#getId() id}. * given {@linkplain Workbasket#getId() id}.
*/ */
void checkAuthorization(String workbasketId, WorkbasketPermission... permission) void checkAuthorization(String workbasketId, WorkbasketPermission... permission)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException; throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException;
/** /**
* This method checks the authorization for the actual User. * This method checks the authorization for the actual User.
@ -454,13 +453,13 @@ public interface WorkbasketService {
* want to access * want to access
* @param permission the needed {@linkplain WorkbasketPermission}; if more than one {@linkplain * @param permission the needed {@linkplain WorkbasketPermission}; if more than one {@linkplain
* WorkbasketPermission permission} is specified, the current user needs all of them. * WorkbasketPermission permission} is specified, the current user needs all of them.
* @throws MismatchedWorkbasketPermissionException if the current user has not the requested * @throws NotAuthorizedOnWorkbasketException if the current user has not the requested
* {@linkplain WorkbasketPermission permission} for the specified {@linkplain Workbasket} * {@linkplain WorkbasketPermission permission} for the specified {@linkplain Workbasket}
* @throws WorkbasketNotFoundException if no {@linkplain Workbasket} can be found for the given * @throws WorkbasketNotFoundException if no {@linkplain Workbasket} can be found for the given
* {@linkplain Workbasket#getKey() key} and {@linkplain Workbasket#getDomain() domain} values. * {@linkplain Workbasket#getKey() key} and {@linkplain Workbasket#getDomain() domain} values.
*/ */
void checkAuthorization(String workbasketKey, String domain, WorkbasketPermission... permission) void checkAuthorization(String workbasketKey, String domain, WorkbasketPermission... permission)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException; throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException;
// endregion // endregion

View File

@ -12,17 +12,18 @@ import pro.taskana.workbasket.api.models.Workbasket;
* This exception is thrown when the current user does not have a certain {@linkplain * This exception is thrown when the current user does not have a certain {@linkplain
* WorkbasketPermission permission} on a {@linkplain Workbasket}. * WorkbasketPermission permission} on a {@linkplain Workbasket}.
*/ */
public class MismatchedWorkbasketPermissionException extends TaskanaException { public class NotAuthorizedOnWorkbasketException extends TaskanaException {
public static final String ERROR_KEY_KEY_DOMAIN = "WORKBASKET_WITH_KEY_MISMATCHED_PERMISSION"; public static final String ERROR_KEY_KEY_DOMAIN =
public static final String ERROR_KEY_ID = "WORKBASKET_WITH_ID_MISMATCHED_PERMISSION"; "NOT_AUTHORIZED_ON_WORKBASKET_WITH_KEY_AND_DOMAIN";
public static final String ERROR_KEY_ID = "NOT_AUTHORIZED_ON_WORKBASKET_WITH_ID";
private final String currentUserId; private final String currentUserId;
private final WorkbasketPermission[] requiredPermissions; private final WorkbasketPermission[] requiredPermissions;
private final String workbasketId; private final String workbasketId;
private final String workbasketKey; private final String workbasketKey;
private final String domain; private final String domain;
public MismatchedWorkbasketPermissionException( public NotAuthorizedOnWorkbasketException(
String currentUserId, String workbasketId, WorkbasketPermission... requiredPermissions) { String currentUserId, String workbasketId, WorkbasketPermission... requiredPermissions) {
super( super(
String.format( String.format(
@ -45,7 +46,7 @@ public class MismatchedWorkbasketPermissionException extends TaskanaException {
domain = null; domain = null;
} }
public MismatchedWorkbasketPermissionException( public NotAuthorizedOnWorkbasketException(
String currentUserId, String currentUserId,
String workbasketKey, String workbasketKey,
String domain, String domain,

View File

@ -10,7 +10,7 @@ import pro.taskana.TaskanaConfiguration;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.TimeInterval; import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.api.exceptions.TaskanaRuntimeException; import pro.taskana.common.api.exceptions.TaskanaRuntimeException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
@ -167,7 +167,7 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
@Override @Override
public WorkbasketQuery accessIdsHavePermissions( public WorkbasketQuery accessIdsHavePermissions(
List<WorkbasketPermission> permissions, String... accessIds) List<WorkbasketPermission> permissions, String... accessIds)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
taskanaEngine taskanaEngine
.getEngine() .getEngine()
.checkRoleMembership(TaskanaRole.ADMIN, TaskanaRole.BUSINESS_ADMIN, TaskanaRole.TASK_ADMIN); .checkRoleMembership(TaskanaRole.ADMIN, TaskanaRole.BUSINESS_ADMIN, TaskanaRole.TASK_ADMIN);

View File

@ -21,7 +21,7 @@ import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.ConcurrencyException; import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.DomainNotFoundException; import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.TaskanaException; import pro.taskana.common.api.exceptions.TaskanaException;
import pro.taskana.common.internal.InternalTaskanaEngine; import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.common.internal.util.IdGenerator; import pro.taskana.common.internal.util.IdGenerator;
@ -43,7 +43,7 @@ import pro.taskana.workbasket.api.WorkbasketAccessItemQuery;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketQuery; import pro.taskana.workbasket.api.WorkbasketQuery;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketAccessItemAlreadyExistException; import pro.taskana.workbasket.api.exceptions.WorkbasketAccessItemAlreadyExistException;
import pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException; import pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException;
import pro.taskana.workbasket.api.exceptions.WorkbasketInUseException; import pro.taskana.workbasket.api.exceptions.WorkbasketInUseException;
@ -82,7 +82,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public Workbasket getWorkbasket(String workbasketId) public Workbasket getWorkbasket(String workbasketId)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException { throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException {
Workbasket result; Workbasket result;
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -109,7 +109,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public Workbasket getWorkbasket(String workbasketKey, String domain) public Workbasket getWorkbasket(String workbasketKey, String domain)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException { throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException {
if (!taskanaEngine if (!taskanaEngine
.getEngine() .getEngine()
.isUserInRole( .isUserInRole(
@ -133,7 +133,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public Workbasket createWorkbasket(Workbasket newWorkbasket) public Workbasket createWorkbasket(Workbasket newWorkbasket)
throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException, throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException,
MismatchedRoleException { NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
WorkbasketImpl workbasket = (WorkbasketImpl) newWorkbasket; WorkbasketImpl workbasket = (WorkbasketImpl) newWorkbasket;
@ -180,7 +180,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public Workbasket updateWorkbasket(Workbasket workbasketToUpdate) public Workbasket updateWorkbasket(Workbasket workbasketToUpdate)
throws InvalidArgumentException, WorkbasketNotFoundException, ConcurrencyException, throws InvalidArgumentException, WorkbasketNotFoundException, ConcurrencyException,
MismatchedRoleException, MismatchedWorkbasketPermissionException { NotAuthorizedException, NotAuthorizedOnWorkbasketException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
WorkbasketImpl workbasketImplToUpdate = (WorkbasketImpl) workbasketToUpdate; WorkbasketImpl workbasketImplToUpdate = (WorkbasketImpl) workbasketToUpdate;
@ -252,7 +252,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public WorkbasketAccessItem createWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) public WorkbasketAccessItem createWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
throws InvalidArgumentException, WorkbasketNotFoundException, throws InvalidArgumentException, WorkbasketNotFoundException,
WorkbasketAccessItemAlreadyExistException, MismatchedRoleException { WorkbasketAccessItemAlreadyExistException, NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
WorkbasketAccessItemImpl accessItem = (WorkbasketAccessItemImpl) workbasketAccessItem; WorkbasketAccessItemImpl accessItem = (WorkbasketAccessItemImpl) workbasketAccessItem;
@ -320,7 +320,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) public WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
WorkbasketAccessItemImpl accessItem = (WorkbasketAccessItemImpl) workbasketAccessItem; WorkbasketAccessItemImpl accessItem = (WorkbasketAccessItemImpl) workbasketAccessItem;
@ -364,7 +364,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
} }
@Override @Override
public void deleteWorkbasketAccessItem(String accessItemId) throws MismatchedRoleException { public void deleteWorkbasketAccessItem(String accessItemId) throws NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -403,7 +403,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public void checkAuthorization(String workbasketId, WorkbasketPermission... requestedPermissions) public void checkAuthorization(String workbasketId, WorkbasketPermission... requestedPermissions)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException { throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException {
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -425,7 +425,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
if (grantedPermissions.isEmpty() if (grantedPermissions.isEmpty()
|| !new HashSet<>(grantedPermissions.get()) || !new HashSet<>(grantedPermissions.get())
.containsAll(Arrays.asList(requestedPermissions))) { .containsAll(Arrays.asList(requestedPermissions))) {
throw new MismatchedWorkbasketPermissionException( throw new NotAuthorizedOnWorkbasketException(
taskanaEngine.getEngine().getCurrentUserContext().getUserid(), taskanaEngine.getEngine().getCurrentUserContext().getUserid(),
workbasketId, workbasketId,
requestedPermissions); requestedPermissions);
@ -438,7 +438,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public void checkAuthorization( public void checkAuthorization(
String workbasketKey, String domain, WorkbasketPermission... requestedPermissions) String workbasketKey, String domain, WorkbasketPermission... requestedPermissions)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException { throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException {
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -460,7 +460,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
if (grantedPermissions.isEmpty() if (grantedPermissions.isEmpty()
|| !new HashSet<>(grantedPermissions.get()) || !new HashSet<>(grantedPermissions.get())
.containsAll(Arrays.asList(requestedPermissions))) { .containsAll(Arrays.asList(requestedPermissions))) {
throw new MismatchedWorkbasketPermissionException( throw new NotAuthorizedOnWorkbasketException(
taskanaEngine.getEngine().getCurrentUserContext().getUserid(), taskanaEngine.getEngine().getCurrentUserContext().getUserid(),
workbasketKey, workbasketKey,
domain, domain,
@ -473,7 +473,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public List<WorkbasketAccessItem> getWorkbasketAccessItems(String workbasketId) public List<WorkbasketAccessItem> getWorkbasketAccessItems(String workbasketId)
throws MismatchedRoleException { throws NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
List<WorkbasketAccessItem> result = new ArrayList<>(); List<WorkbasketAccessItem> result = new ArrayList<>();
try { try {
@ -491,8 +491,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
public void setWorkbasketAccessItems( public void setWorkbasketAccessItems(
String workbasketId, List<WorkbasketAccessItem> wbAccessItems) String workbasketId, List<WorkbasketAccessItem> wbAccessItems)
throws WorkbasketAccessItemAlreadyExistException, InvalidArgumentException, throws WorkbasketAccessItemAlreadyExistException, InvalidArgumentException,
WorkbasketNotFoundException, MismatchedRoleException, WorkbasketNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException {
MismatchedWorkbasketPermissionException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
Set<WorkbasketAccessItemImpl> accessItems = Set<WorkbasketAccessItemImpl> accessItems =
@ -538,8 +537,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
} }
@Override @Override
public WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() public WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws NotAuthorizedException {
throws MismatchedRoleException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN, TaskanaRole.BUSINESS_ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN, TaskanaRole.BUSINESS_ADMIN);
return new WorkbasketAccessItemQueryImpl(this.taskanaEngine); return new WorkbasketAccessItemQueryImpl(this.taskanaEngine);
} }
@ -562,7 +560,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public List<WorkbasketSummary> getDistributionTargets(String workbasketId) public List<WorkbasketSummary> getDistributionTargets(String workbasketId)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException { throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException {
List<WorkbasketSummary> result = new ArrayList<>(); List<WorkbasketSummary> result = new ArrayList<>();
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -584,7 +582,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public List<WorkbasketSummary> getDistributionTargets(String workbasketKey, String domain) public List<WorkbasketSummary> getDistributionTargets(String workbasketKey, String domain)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException { throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException {
List<WorkbasketSummary> result = new ArrayList<>(); List<WorkbasketSummary> result = new ArrayList<>();
try { try {
@ -607,8 +605,8 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public void setDistributionTargets(String sourceWorkbasketId, List<String> targetWorkbasketIds) public void setDistributionTargets(String sourceWorkbasketId, List<String> targetWorkbasketIds)
throws WorkbasketNotFoundException, MismatchedRoleException, throws WorkbasketNotFoundException, NotAuthorizedException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
try { try {
@ -669,8 +667,8 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) public void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
throws WorkbasketNotFoundException, MismatchedRoleException, throws WorkbasketNotFoundException, NotAuthorizedException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
try { try {
@ -721,7 +719,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) public void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
throws MismatchedRoleException, MismatchedWorkbasketPermissionException { throws NotAuthorizedException, NotAuthorizedOnWorkbasketException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
try { try {
@ -787,7 +785,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public boolean deleteWorkbasket(String workbasketId) public boolean deleteWorkbasket(String workbasketId)
throws WorkbasketNotFoundException, WorkbasketInUseException, InvalidArgumentException, throws WorkbasketNotFoundException, WorkbasketInUseException, InvalidArgumentException,
MismatchedRoleException, MismatchedWorkbasketPermissionException { NotAuthorizedException, NotAuthorizedOnWorkbasketException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
validateId(workbasketId); validateId(workbasketId);
@ -847,7 +845,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
} }
public BulkOperationResults<String, TaskanaException> deleteWorkbaskets( public BulkOperationResults<String, TaskanaException> deleteWorkbaskets(
List<String> workbasketsIds) throws InvalidArgumentException, MismatchedRoleException { List<String> workbasketsIds) throws InvalidArgumentException, NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
@ -880,7 +878,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public List<WorkbasketSummary> getDistributionSources(String workbasketId) public List<WorkbasketSummary> getDistributionSources(String workbasketId)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException { throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException {
List<WorkbasketSummary> result = new ArrayList<>(); List<WorkbasketSummary> result = new ArrayList<>();
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -900,7 +898,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public List<WorkbasketSummary> getDistributionSources(String workbasketKey, String domain) public List<WorkbasketSummary> getDistributionSources(String workbasketKey, String domain)
throws WorkbasketNotFoundException, MismatchedWorkbasketPermissionException { throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException {
List<WorkbasketSummary> result = new ArrayList<>(); List<WorkbasketSummary> result = new ArrayList<>();
try { try {
@ -921,7 +919,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public void deleteWorkbasketAccessItemsForAccessId(String accessId) public void deleteWorkbasketAccessItemsForAccessId(String accessId)
throws MismatchedRoleException { throws NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
@ -1115,7 +1113,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
} }
private void markWorkbasketForDeletion(String workbasketId) private void markWorkbasketForDeletion(String workbasketId)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();

View File

@ -9,7 +9,7 @@ import pro.taskana.common.api.BulkOperationResults;
import pro.taskana.common.api.ScheduledJob; import pro.taskana.common.api.ScheduledJob;
import pro.taskana.common.api.TaskanaEngine; import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.api.exceptions.TaskanaException; import pro.taskana.common.api.exceptions.TaskanaException;
import pro.taskana.common.internal.jobs.AbstractTaskanaJob; import pro.taskana.common.internal.jobs.AbstractTaskanaJob;
@ -77,7 +77,7 @@ public class WorkbasketCleanupJob extends AbstractTaskanaJob {
} }
private int deleteWorkbaskets(List<String> workbasketsToBeDeleted) private int deleteWorkbaskets(List<String> workbasketsToBeDeleted)
throws InvalidArgumentException, MismatchedRoleException { throws InvalidArgumentException, NotAuthorizedException {
BulkOperationResults<String, TaskanaException> results = BulkOperationResults<String, TaskanaException> results =
taskanaEngineImpl.getWorkbasketService().deleteWorkbaskets(workbasketsToBeDeleted); taskanaEngineImpl.getWorkbasketService().deleteWorkbaskets(workbasketsToBeDeleted);

View File

@ -8,7 +8,7 @@ import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.MonitorService; import pro.taskana.monitor.api.MonitorService;
@ -27,7 +27,7 @@ class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest {
MONITOR_SERVICE MONITOR_SERVICE
.createWorkbasketReportBuilder() .createWorkbasketReportBuilder()
.listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_2); .listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_2);
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -17,7 +17,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.MonitorService; import pro.taskana.monitor.api.MonitorService;
@ -45,7 +45,7 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT
MONITOR_SERVICE MONITOR_SERVICE
.createClassificationCategoryReportBuilder() .createClassificationCategoryReportBuilder()
.listTaskIdsForSelectedItems(List.of(), TaskTimestamp.DUE); .listTaskIdsForSelectedItems(List.of(), TaskTimestamp.DUE);
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -16,7 +16,7 @@ import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.MonitorService; import pro.taskana.monitor.api.MonitorService;
@ -45,7 +45,7 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
MONITOR_SERVICE MONITOR_SERVICE
.createClassificationReportBuilder() .createClassificationReportBuilder()
.listTaskIdsForSelectedItems(selectedItems, TaskTimestamp.DUE); .listTaskIdsForSelectedItems(selectedItems, TaskTimestamp.DUE);
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -17,7 +17,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.MonitorService; import pro.taskana.monitor.api.MonitorService;
@ -47,7 +47,7 @@ class GetTaskIdsOfTaskCustomFieldValueReportAccTest extends AbstractReportAccTes
MONITOR_SERVICE MONITOR_SERVICE
.createTaskCustomFieldValueReportBuilder(TaskCustomField.CUSTOM_1) .createTaskCustomFieldValueReportBuilder(TaskCustomField.CUSTOM_1)
.listTaskIdsForSelectedItems(List.of(), TaskTimestamp.DUE); .listTaskIdsForSelectedItems(List.of(), TaskTimestamp.DUE);
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -16,7 +16,7 @@ import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.CombinedClassificationFilter; import pro.taskana.monitor.api.CombinedClassificationFilter;
@ -44,7 +44,7 @@ class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
MONITOR_SERVICE MONITOR_SERVICE
.createWorkbasketReportBuilder() .createWorkbasketReportBuilder()
.listTaskIdsForSelectedItems(List.of(), TaskTimestamp.DUE); .listTaskIdsForSelectedItems(List.of(), TaskTimestamp.DUE);
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -16,7 +16,7 @@ import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.MonitorService; import pro.taskana.monitor.api.MonitorService;
@ -37,7 +37,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
void testRoleCheck() { void testRoleCheck() {
ThrowingCallable call = ThrowingCallable call =
() -> MONITOR_SERVICE.createClassificationCategoryReportBuilder().buildReport(); () -> MONITOR_SERVICE.createClassificationCategoryReportBuilder().buildReport();
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -16,7 +16,7 @@ import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.MonitorService; import pro.taskana.monitor.api.MonitorService;
@ -36,7 +36,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@Test @Test
void testRoleCheck() { void testRoleCheck() {
assertThatThrownBy(() -> MONITOR_SERVICE.createClassificationReportBuilder().buildReport()) assertThatThrownBy(() -> MONITOR_SERVICE.createClassificationReportBuilder().buildReport())
.isInstanceOf(MismatchedRoleException.class); .isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -16,7 +16,7 @@ import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.MonitorService; import pro.taskana.monitor.api.MonitorService;
@ -41,7 +41,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
void testRoleCheck() { void testRoleCheck() {
ThrowingCallable call = ThrowingCallable call =
() -> MONITOR_SERVICE.createClassificationReportBuilder().buildDetailedReport(); () -> MONITOR_SERVICE.createClassificationReportBuilder().buildDetailedReport();
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -16,7 +16,7 @@ import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.MonitorService; import pro.taskana.monitor.api.MonitorService;
@ -41,7 +41,7 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
.createTaskCustomFieldValueReportBuilder(TaskCustomField.CUSTOM_1) .createTaskCustomFieldValueReportBuilder(TaskCustomField.CUSTOM_1)
.buildReport(); .buildReport();
}; };
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.MonitorService; import pro.taskana.monitor.api.MonitorService;
@ -34,7 +34,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
@Test @Test
void should_ThrowException_When_UserIsNotAuthorized() { void should_ThrowException_When_UserIsNotAuthorized() {
assertThatThrownBy(() -> MONITOR_SERVICE.createTaskStatusReportBuilder().buildReport()) assertThatThrownBy(() -> MONITOR_SERVICE.createTaskStatusReportBuilder().buildReport())
.isInstanceOf(MismatchedRoleException.class); .isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "unknown") @WithAccessId(user = "unknown")
@ -44,7 +44,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
@TestTemplate @TestTemplate
void should_ThrowException_When_UserIsNotAdminOrMonitor() { void should_ThrowException_When_UserIsNotAdminOrMonitor() {
assertThatThrownBy(() -> MONITOR_SERVICE.createTaskStatusReportBuilder().buildReport()) assertThatThrownBy(() -> MONITOR_SERVICE.createTaskStatusReportBuilder().buildReport())
.isInstanceOf(MismatchedRoleException.class); .isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "admin") @WithAccessId(user = "admin")

View File

@ -16,7 +16,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.api.IntInterval; import pro.taskana.common.api.IntInterval;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.util.Pair; import pro.taskana.common.internal.util.Pair;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
@ -59,7 +59,7 @@ class ProvideWorkbasketPriorityReportAccTest extends AbstractReportAccTest {
@TestTemplate @TestTemplate
void should_ThrowMismatchedRoleException_When_UserDoesNotHaveCorrectRole() { void should_ThrowMismatchedRoleException_When_UserDoesNotHaveCorrectRole() {
assertThatThrownBy(() -> MONITOR_SERVICE.createWorkbasketPriorityReportBuilder().buildReport()) assertThatThrownBy(() -> MONITOR_SERVICE.createWorkbasketPriorityReportBuilder().buildReport())
.isInstanceOf(MismatchedRoleException.class); .isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -16,7 +16,7 @@ import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.monitor.api.CombinedClassificationFilter; import pro.taskana.monitor.api.CombinedClassificationFilter;
@ -36,7 +36,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@Test @Test
void testRoleCheck() { void testRoleCheck() {
assertThatThrownBy(() -> MONITOR_SERVICE.createWorkbasketReportBuilder().buildReport()) assertThatThrownBy(() -> MONITOR_SERVICE.createWorkbasketReportBuilder().buildReport())
.isInstanceOf(MismatchedRoleException.class); .isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "monitor") @WithAccessId(user = "monitor")

View File

@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.TaskanaRole;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
@ -27,7 +27,7 @@ class TaskanaSecurityAccTest extends AbstractAccTest {
assertThat(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)).isFalse(); assertThat(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)).isFalse();
assertThat(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)).isFalse(); assertThat(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)).isFalse();
ThrowingCallable call = () -> taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN); ThrowingCallable call = () -> taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN);
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "businessadmin") @WithAccessId(user = "businessadmin")
@ -50,7 +50,7 @@ class TaskanaSecurityAccTest extends AbstractAccTest {
assertThat(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)).isFalse(); assertThat(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)).isFalse();
assertThat(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)).isFalse(); assertThat(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)).isFalse();
ThrowingCallable call = () -> taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN); ThrowingCallable call = () -> taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN);
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "user-1-1", groups = "businessadmin") @WithAccessId(user = "user-1-1", groups = "businessadmin")

View File

@ -27,7 +27,7 @@ import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.task.api.TaskService; import pro.taskana.task.api.TaskService;
import pro.taskana.task.api.exceptions.TaskNotFoundException; import pro.taskana.task.api.exceptions.TaskNotFoundException;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
/** Acceptance test for all "create task" scenarios. */ /** Acceptance test for all "create task" scenarios. */
@ExtendWith(JaasExtension.class) @ExtendWith(JaasExtension.class)
@ -342,7 +342,7 @@ class ServiceLevelPriorityAccTest extends AbstractAccTest {
assertThat(results.containsErrors()).isTrue(); assertThat(results.containsErrors()).isTrue();
assertThat(results.getFailedIds()).hasSize(3).containsAnyElementsOf(taskIds); assertThat(results.getFailedIds()).hasSize(3).containsAnyElementsOf(taskIds);
assertThat(results.getErrorMap().values()) assertThat(results.getErrorMap().values())
.hasOnlyElementsOfType(MismatchedWorkbasketPermissionException.class); .hasOnlyElementsOfType(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "admin") @WithAccessId(user = "admin")

View File

@ -15,7 +15,7 @@ import pro.taskana.task.api.TaskService;
import pro.taskana.task.api.TaskState; import pro.taskana.task.api.TaskState;
import pro.taskana.task.api.exceptions.InvalidOwnerException; import pro.taskana.task.api.exceptions.InvalidOwnerException;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
@ExtendWith(JaasExtension.class) @ExtendWith(JaasExtension.class)
class ClaimTaskAccTest extends AbstractAccTest { class ClaimTaskAccTest extends AbstractAccTest {
@ -129,14 +129,14 @@ class ClaimTaskAccTest extends AbstractAccTest {
@Test @Test
void should_ThrowNotAuthorizedException_When_UserHasNoReadPermissionAndTaskIsReady() { void should_ThrowNotAuthorizedException_When_UserHasNoReadPermissionAndTaskIsReady() {
assertThatThrownBy(() -> taskService.claim("TKI:000000000000000000000000000000000000")) assertThatThrownBy(() -> taskService.claim("TKI:000000000000000000000000000000000000"))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-taskrouter") @WithAccessId(user = "user-taskrouter")
@Test @Test
void should_ThrowNotAuthorizedException_When_UserHasNoReadPermissionAndTaskIsReadyForReview() { void should_ThrowNotAuthorizedException_When_UserHasNoReadPermissionAndTaskIsReadyForReview() {
assertThatThrownBy(() -> taskService.claim("TKI:500000000000000000000000000000000028")) assertThatThrownBy(() -> taskService.claim("TKI:500000000000000000000000000000000028"))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-1-2") @WithAccessId(user = "user-1-2")

View File

@ -23,7 +23,7 @@ import pro.taskana.task.api.exceptions.InvalidTaskStateException;
import pro.taskana.task.api.exceptions.TaskNotFoundException; import pro.taskana.task.api.exceptions.TaskNotFoundException;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.task.api.models.TaskSummary; import pro.taskana.task.api.models.TaskSummary;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
/** Acceptance test for all "set owner" scenarios. */ /** Acceptance test for all "set owner" scenarios. */
@ExtendWith(JaasExtension.class) @ExtendWith(JaasExtension.class)
@ -76,9 +76,9 @@ class SetOwnerAccTest extends AbstractAccTest {
String anyUserName = "TestUser3"; String anyUserName = "TestUser3";
assertThatThrownBy(() -> taskService.getTask(taskReadyId)) assertThatThrownBy(() -> taskService.getTask(taskReadyId))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
assertThatThrownBy(() -> setOwner(taskReadyId, anyUserName)) assertThatThrownBy(() -> setOwner(taskReadyId, anyUserName))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-1-2") @WithAccessId(user = "user-1-2")
@ -104,12 +104,12 @@ class SetOwnerAccTest extends AbstractAccTest {
String anyUserName = "TestUser3"; String anyUserName = "TestUser3";
assertThatThrownBy(() -> taskService.getTask(taskReadyId)) assertThatThrownBy(() -> taskService.getTask(taskReadyId))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
BulkOperationResults<String, TaskanaException> results = BulkOperationResults<String, TaskanaException> results =
taskService.setOwnerOfTasks(anyUserName, List.of(taskReadyId)); taskService.setOwnerOfTasks(anyUserName, List.of(taskReadyId));
assertThat(results.containsErrors()).isTrue(); assertThat(results.containsErrors()).isTrue();
assertThat(results.getErrorForId(taskReadyId)) assertThat(results.getErrorForId(taskReadyId))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-1-2") @WithAccessId(user = "user-1-2")
@ -203,13 +203,13 @@ class SetOwnerAccTest extends AbstractAccTest {
c -> c.getClass() == InvalidTaskStateException.class, "InvalidStateException"); c -> c.getClass() == InvalidTaskStateException.class, "InvalidStateException");
Condition<Object> mismatchedWorkbasketPermissionException = Condition<Object> mismatchedWorkbasketPermissionException =
new Condition<>( new Condition<>(
c -> c.getClass() == MismatchedWorkbasketPermissionException.class, c -> c.getClass() == NotAuthorizedOnWorkbasketException.class,
"MismatchedWorkbasketPermissionException"); "MismatchedWorkbasketPermissionException");
assertThat(results.getErrorMap()) assertThat(results.getErrorMap())
.hasSize(95) .hasSize(95)
.extractingFromEntries(Entry::getValue) .extractingFromEntries(Entry::getValue)
.hasOnlyElementsOfTypes( .hasOnlyElementsOfTypes(
InvalidTaskStateException.class, MismatchedWorkbasketPermissionException.class) InvalidTaskStateException.class, NotAuthorizedOnWorkbasketException.class)
.areExactly(35, invalidTaskStateException) .areExactly(35, invalidTaskStateException)
.areExactly(60, mismatchedWorkbasketPermissionException); .areExactly(60, mismatchedWorkbasketPermissionException);
} }

View File

@ -17,7 +17,7 @@ import pro.taskana.task.api.TaskState;
import pro.taskana.task.api.exceptions.InvalidTaskStateException; import pro.taskana.task.api.exceptions.InvalidTaskStateException;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.task.api.models.TaskSummary; import pro.taskana.task.api.models.TaskSummary;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
/** Acceptance tests for all "cancel task" scenarios. */ /** Acceptance tests for all "cancel task" scenarios. */
@ExtendWith(JaasExtension.class) @ExtendWith(JaasExtension.class)
@ -85,7 +85,7 @@ class CancelTaskAccTest extends AbstractAccTest {
@Test @Test
void should_ThrowException_When_UserNotAuthorized() { void should_ThrowException_When_UserNotAuthorized() {
assertThatThrownBy(() -> taskService.cancelTask("TKI:000000000000000000000000000000000001")) assertThatThrownBy(() -> taskService.cancelTask("TKI:000000000000000000000000000000000001"))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "admin") @WithAccessId(user = "admin")

View File

@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.task.api.TaskState; import pro.taskana.task.api.TaskState;
@ -84,7 +84,7 @@ class TerminateTaskAccTest extends AbstractAccTest {
ThrowingCallable taskanaCall = ThrowingCallable taskanaCall =
() -> taskService.terminateTask("TKI:000000000000000000000000000000000000"); () -> taskService.terminateTask("TKI:000000000000000000000000000000000000");
assertThatThrownBy(taskanaCall).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(taskanaCall).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "taskadmin") @WithAccessId(user = "taskadmin")

View File

@ -41,7 +41,7 @@ import pro.taskana.task.internal.AttachmentMapper;
import pro.taskana.task.internal.models.ObjectReferenceImpl; import pro.taskana.task.internal.models.ObjectReferenceImpl;
import pro.taskana.task.internal.models.TaskImpl; import pro.taskana.task.internal.models.TaskImpl;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.api.models.Workbasket; import pro.taskana.workbasket.api.models.Workbasket;
@ -678,7 +678,7 @@ class CreateTaskAccTest extends AbstractAccTest {
createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567")); createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
ThrowingCallable call = () -> taskService.createTask(newTask); ThrowingCallable call = () -> taskService.createTask(newTask);
assertThatThrownBy(call).isInstanceOf(MismatchedWorkbasketPermissionException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")
@ -802,7 +802,7 @@ class CreateTaskAccTest extends AbstractAccTest {
createObjectReference("COMPANY_B", "SYSTEM_B", "INSTANCE_B", "VNR", "1234567")); createObjectReference("COMPANY_B", "SYSTEM_B", "INSTANCE_B", "VNR", "1234567"));
ThrowingCallable call = () -> taskService.createTask(newTask); ThrowingCallable call = () -> taskService.createTask(newTask);
assertThatThrownBy(call).isInstanceOf(MismatchedWorkbasketPermissionException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")
@ -823,7 +823,7 @@ class CreateTaskAccTest extends AbstractAccTest {
Task task = taskService.newTask("TEAMLEAD-2", "DOMAIN_A"); Task task = taskService.newTask("TEAMLEAD-2", "DOMAIN_A");
ThrowingCallable call = () -> taskService.createTask(task); ThrowingCallable call = () -> taskService.createTask(task);
assertThatThrownBy(call).isInstanceOf(MismatchedWorkbasketPermissionException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")

View File

@ -12,7 +12,7 @@ import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.BulkOperationResults; import pro.taskana.common.api.BulkOperationResults;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.TaskanaException; import pro.taskana.common.api.exceptions.TaskanaException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
@ -31,7 +31,7 @@ class DeleteTaskAccTest extends AbstractAccTest {
ThrowingCallable call = ThrowingCallable call =
() -> taskService.deleteTask("TKI:000000000000000000000000000000000037"); () -> taskService.deleteTask("TKI:000000000000000000000000000000000037");
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "user-taskrouter") @WithAccessId(user = "user-taskrouter")
@ -39,7 +39,7 @@ class DeleteTaskAccTest extends AbstractAccTest {
void should_ThrowNotAuthorizedException_When_UserIsMemberOfTaskRouterRole() { void should_ThrowNotAuthorizedException_When_UserIsMemberOfTaskRouterRole() {
ThrowingCallable call = ThrowingCallable call =
() -> taskService.deleteTask("TKI:000000000000000000000000000000000037"); () -> taskService.deleteTask("TKI:000000000000000000000000000000000037");
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "admin") @WithAccessId(user = "admin")
@ -120,7 +120,7 @@ class DeleteTaskAccTest extends AbstractAccTest {
"TKI:000000000000000000000000000000000010"); "TKI:000000000000000000000000000000000010");
ThrowingCallable call = () -> taskService.deleteTasks(taskIds); ThrowingCallable call = () -> taskService.deleteTasks(taskIds);
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "admin") @WithAccessId(user = "admin")
@ -141,7 +141,7 @@ class DeleteTaskAccTest extends AbstractAccTest {
void should_ThrowException_When_UserIsNotInAdminRole() { void should_ThrowException_When_UserIsNotInAdminRole() {
ThrowingCallable deleteTaskCall = ThrowingCallable deleteTaskCall =
() -> taskService.deleteTask("TKI:000000000000000000000000000000000041"); () -> taskService.deleteTask("TKI:000000000000000000000000000000000041");
assertThatThrownBy(deleteTaskCall).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(deleteTaskCall).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "admin") @WithAccessId(user = "admin")

View File

@ -20,7 +20,7 @@ import pro.taskana.task.api.TaskService;
import pro.taskana.task.api.TaskState; import pro.taskana.task.api.TaskState;
import pro.taskana.task.api.exceptions.TaskNotFoundException; import pro.taskana.task.api.exceptions.TaskNotFoundException;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
/** Acceptance test for all "get task" scenarios. */ /** Acceptance test for all "get task" scenarios. */
@ExtendWith(JaasExtension.class) @ExtendWith(JaasExtension.class)
@ -133,7 +133,7 @@ class GetTaskAccTest extends AbstractAccTest {
ThrowingCallable getTaskCall = ThrowingCallable getTaskCall =
() -> taskService.getTask("TKI:000000000000000000000000000000000000"); () -> taskService.getTask("TKI:000000000000000000000000000000000000");
assertThatThrownBy(getTaskCall).isInstanceOf(MismatchedWorkbasketPermissionException.class); assertThatThrownBy(getTaskCall).isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-taskrouter") @WithAccessId(user = "user-taskrouter")
@ -142,7 +142,7 @@ class GetTaskAccTest extends AbstractAccTest {
ThrowingCallable getTaskCall = ThrowingCallable getTaskCall =
() -> taskService.getTask("TKI:000000000000000000000000000000000000"); () -> taskService.getTask("TKI:000000000000000000000000000000000000");
assertThatThrownBy(getTaskCall).isInstanceOf(MismatchedWorkbasketPermissionException.class); assertThatThrownBy(getTaskCall).isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "admin") @WithAccessId(user = "admin")

View File

@ -30,7 +30,7 @@ import pro.taskana.task.api.exceptions.InvalidTaskStateException;
import pro.taskana.task.api.exceptions.TaskNotFoundException; import pro.taskana.task.api.exceptions.TaskNotFoundException;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.task.api.models.TaskSummary; import pro.taskana.task.api.models.TaskSummary;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.api.models.Workbasket; import pro.taskana.workbasket.api.models.Workbasket;
@ -152,7 +152,7 @@ class TransferTaskAccTest extends AbstractAccTest {
ThrowingCallable call = ThrowingCallable call =
() -> taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000005"); () -> taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000005");
assertThatThrownBy(call).isInstanceOf(MismatchedWorkbasketPermissionException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-1-1", groups = "cn=routers,cn=groups,OU=Test,O=TASKANA") @WithAccessId(user = "user-1-1", groups = "cn=routers,cn=groups,OU=Test,O=TASKANA")
@ -163,7 +163,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThatThrownBy( assertThatThrownBy(
() -> taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000005")) () -> taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000005"))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "teamlead-1", groups = GROUP_1_DN) @WithAccessId(user = "teamlead-1", groups = GROUP_1_DN)
@ -194,7 +194,7 @@ class TransferTaskAccTest extends AbstractAccTest {
"TKI:200000000000000000000000000000000007", "TKI:200000000000000000000000000000000007",
"WBI:100000000000000000000000000000000001"); "WBI:100000000000000000000000000000000001");
assertThatThrownBy(call) assertThatThrownBy(call)
.isInstanceOf(MismatchedWorkbasketPermissionException.class) .isInstanceOf(NotAuthorizedOnWorkbasketException.class)
.extracting(Throwable::getMessage) .extracting(Throwable::getMessage)
.asString() .asString()
.startsWith( .startsWith(
@ -210,7 +210,7 @@ class TransferTaskAccTest extends AbstractAccTest {
ThrowingCallable call = ThrowingCallable call =
() -> taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000008"); () -> taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000008");
assertThatThrownBy(call) assertThatThrownBy(call)
.isInstanceOf(MismatchedWorkbasketPermissionException.class) .isInstanceOf(NotAuthorizedOnWorkbasketException.class)
.extracting(Throwable::getMessage) .extracting(Throwable::getMessage)
.asString() .asString()
.startsWith( .startsWith(
@ -287,9 +287,9 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThat(results.containsErrors()).isTrue(); assertThat(results.containsErrors()).isTrue();
assertThat(results.getErrorMap().values()).hasSize(6); assertThat(results.getErrorMap().values()).hasSize(6);
assertThat(results.getErrorForId("TKI:000000000000000000000000000000000041").getClass()) assertThat(results.getErrorForId("TKI:000000000000000000000000000000000041").getClass())
.isEqualTo(MismatchedWorkbasketPermissionException.class); .isEqualTo(NotAuthorizedOnWorkbasketException.class);
assertThat(results.getErrorForId("TKI:200000000000000000000000000000000008").getClass()) assertThat(results.getErrorForId("TKI:200000000000000000000000000000000008").getClass())
.isEqualTo(MismatchedWorkbasketPermissionException.class); .isEqualTo(NotAuthorizedOnWorkbasketException.class);
assertThat(results.getErrorForId("TKI:000000000000000000000000000000000099").getClass()) assertThat(results.getErrorForId("TKI:000000000000000000000000000000000099").getClass())
.isEqualTo(TaskNotFoundException.class); .isEqualTo(TaskNotFoundException.class);
assertThat(results.getErrorForId("TKI:100000000000000000000000000000000006").getClass()) assertThat(results.getErrorForId("TKI:100000000000000000000000000000000006").getClass())
@ -331,7 +331,7 @@ class TransferTaskAccTest extends AbstractAccTest {
ThrowingCallable call = ThrowingCallable call =
() -> taskService.transferTasks("WBI:100000000000000000000000000000000010", taskIdList); () -> taskService.transferTasks("WBI:100000000000000000000000000000000010", taskIdList);
assertThatThrownBy(call) assertThatThrownBy(call)
.isInstanceOf(MismatchedWorkbasketPermissionException.class) .isInstanceOf(NotAuthorizedOnWorkbasketException.class)
.hasMessageContaining("APPEND"); .hasMessageContaining("APPEND");
} }

View File

@ -37,7 +37,7 @@ import pro.taskana.task.api.models.Task;
import pro.taskana.task.api.models.TaskSummary; import pro.taskana.task.api.models.TaskSummary;
import pro.taskana.task.internal.models.ObjectReferenceImpl; import pro.taskana.task.internal.models.ObjectReferenceImpl;
import pro.taskana.task.internal.models.TaskImpl; import pro.taskana.task.internal.models.TaskImpl;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
/** Acceptance test for all "update task" scenarios. */ /** Acceptance test for all "update task" scenarios. */
@ExtendWith(JaasExtension.class) @ExtendWith(JaasExtension.class)
@ -179,7 +179,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
task.setWorkbasketKey("USER-1-2"); task.setWorkbasketKey("USER-1-2");
assertThatThrownBy(() -> taskService.updateTask(task)) assertThatThrownBy(() -> taskService.updateTask(task))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")

View File

@ -14,7 +14,7 @@ import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.task.api.TaskService; import pro.taskana.task.api.TaskService;
import pro.taskana.task.api.exceptions.MismatchedTaskCommentCreatorException; import pro.taskana.task.api.exceptions.NotAuthorizedOnTaskCommentException;
import pro.taskana.task.api.exceptions.TaskCommentNotFoundException; import pro.taskana.task.api.exceptions.TaskCommentNotFoundException;
import pro.taskana.task.api.models.TaskComment; import pro.taskana.task.api.models.TaskComment;
@ -56,7 +56,7 @@ class DeleteTaskCommentAccTest extends AbstractAccTest {
ThrowingCallable lambda = ThrowingCallable lambda =
() -> taskService.deleteTaskComment("TCI:000000000000000000000000000000000000"); () -> taskService.deleteTaskComment("TCI:000000000000000000000000000000000000");
assertThatThrownBy(lambda).isInstanceOf(MismatchedTaskCommentCreatorException.class); assertThatThrownBy(lambda).isInstanceOf(NotAuthorizedOnTaskCommentException.class);
// make sure the task comment was not deleted // make sure the task comment was not deleted
List<TaskComment> taskCommentsAfterDeletion = List<TaskComment> taskCommentsAfterDeletion =

View File

@ -12,7 +12,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.DomainNotFoundException; import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
@ -70,7 +70,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
workbasket.setOrgLevel1("company"); workbasket.setOrgLevel1("company");
ThrowingCallable call = () -> workbasketService.createWorkbasket(workbasket); ThrowingCallable call = () -> workbasketService.createWorkbasket(workbasket);
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "businessadmin") @WithAccessId(user = "businessadmin")

View File

@ -6,7 +6,7 @@ import acceptance.AbstractAccTest;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
@ -29,6 +29,6 @@ class CreateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
accessItem.setPermission(WorkbasketPermission.CUSTOM_11, true); accessItem.setPermission(WorkbasketPermission.CUSTOM_11, true);
accessItem.setPermission(WorkbasketPermission.READ, true); accessItem.setPermission(WorkbasketPermission.READ, true);
assertThatThrownBy(() -> workbasketService.createWorkbasketAccessItem(accessItem)) assertThatThrownBy(() -> workbasketService.createWorkbasketAccessItem(accessItem))
.isInstanceOf(MismatchedRoleException.class); .isInstanceOf(NotAuthorizedException.class);
} }
} }

View File

@ -18,7 +18,7 @@ import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.task.internal.models.TaskImpl; import pro.taskana.task.internal.models.TaskImpl;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketInUseException; import pro.taskana.workbasket.api.exceptions.WorkbasketInUseException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.api.models.Workbasket; import pro.taskana.workbasket.api.models.Workbasket;
@ -75,7 +75,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
@Test @Test
void should_ThrowNotAuthorizedException_When_UnauthorizedTryingToGetWorkbaskets() { void should_ThrowNotAuthorizedException_When_UnauthorizedTryingToGetWorkbaskets() {
assertThatThrownBy(() -> workbasketService.getWorkbasket("TEAMLEAD-2", "DOMAIN_A")) assertThatThrownBy(() -> workbasketService.getWorkbasket("TEAMLEAD-2", "DOMAIN_A"))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "businessadmin") @WithAccessId(user = "businessadmin")

View File

@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
@ -30,14 +30,14 @@ class DeleteWorkbasketAuthorizationsAccTest extends AbstractAccTest {
WORKBASKET_SERVICE.deleteWorkbasketAccessItemsForAccessId("group-1"); WORKBASKET_SERVICE.deleteWorkbasketAccessItemsForAccessId("group-1");
}; };
assertThatThrownBy(deleteWorkbasketAccessItemCall).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(deleteWorkbasketAccessItemCall).isInstanceOf(NotAuthorizedException.class);
deleteWorkbasketAccessItemCall = deleteWorkbasketAccessItemCall =
() -> { () -> {
WORKBASKET_SERVICE.deleteWorkbasketAccessItem("WAI:100000000000000000000000000000000001"); WORKBASKET_SERVICE.deleteWorkbasketAccessItem("WAI:100000000000000000000000000000000001");
}; };
assertThatThrownBy(deleteWorkbasketAccessItemCall).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(deleteWorkbasketAccessItemCall).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "admin") @WithAccessId(user = "admin")

View File

@ -10,11 +10,11 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.api.models.WorkbasketSummary;
@ -116,7 +116,7 @@ class GetDistributionTargetsAccTest extends AbstractAccTest {
workbasketService.setDistributionTargets( workbasketService.setDistributionTargets(
existingWb, List.of("WBI:100000000000000000000000000000000002")); existingWb, List.of("WBI:100000000000000000000000000000000002"));
}; };
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")
@ -131,7 +131,7 @@ class GetDistributionTargetsAccTest extends AbstractAccTest {
workbasketService.getDistributionTargets(existingWb); workbasketService.getDistributionTargets(existingWb);
}; };
assertThatThrownBy(getDistributionTargetsCall) assertThatThrownBy(getDistributionTargetsCall)
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "businessadmin") @WithAccessId(user = "businessadmin")
@ -169,7 +169,7 @@ class GetDistributionTargetsAccTest extends AbstractAccTest {
ThrowingCallable call = ThrowingCallable call =
() -> workbasketService.getDistributionSources("WBI:100000000000000000000000000000000004"); () -> workbasketService.getDistributionSources("WBI:100000000000000000000000000000000004");
assertThatThrownBy(call).isInstanceOf(MismatchedWorkbasketPermissionException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-2-2") @WithAccessId(user = "user-2-2")

View File

@ -19,7 +19,7 @@ import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.WorkbasketType; import pro.taskana.workbasket.api.WorkbasketType;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.api.models.Workbasket; import pro.taskana.workbasket.api.models.Workbasket;
import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.api.models.WorkbasketSummary;
@ -169,13 +169,13 @@ class GetWorkbasketAccTest extends AbstractAccTest {
void should_ThrowException_When_TryingToGetByIdWithoutPermissions() { void should_ThrowException_When_TryingToGetByIdWithoutPermissions() {
ThrowingCallable call = ThrowingCallable call =
() -> WORKBASKET_SERVICE.getWorkbasket("WBI:100000000000000000000000000000000001"); () -> WORKBASKET_SERVICE.getWorkbasket("WBI:100000000000000000000000000000000001");
assertThatThrownBy(call).isInstanceOf(MismatchedWorkbasketPermissionException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@Test @Test
void should_ThrowException_When_TryingToGetByKeyAndDomainWithoutPermissions() { void should_ThrowException_When_TryingToGetByKeyAndDomainWithoutPermissions() {
assertThatThrownBy(() -> WORKBASKET_SERVICE.getWorkbasket("GPK_KSC", "DOMAIN_A")) assertThatThrownBy(() -> WORKBASKET_SERVICE.getWorkbasket("GPK_KSC", "DOMAIN_A"))
.isInstanceOf(MismatchedWorkbasketPermissionException.class); .isInstanceOf(NotAuthorizedOnWorkbasketException.class);
} }
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")

View File

@ -7,7 +7,7 @@ import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
@ -28,7 +28,6 @@ class GetWorkbasketAuthorizationsAccTest extends AbstractAccTest {
workbasketService.getWorkbasketAccessItems("WBI:100000000000000000000000000000000008"); workbasketService.getWorkbasketAccessItems("WBI:100000000000000000000000000000000008");
}; };
assertThatThrownBy(retrieveWorkbasketAccessItemCall) assertThatThrownBy(retrieveWorkbasketAccessItemCall).isInstanceOf(NotAuthorizedException.class);
.isInstanceOf(MismatchedRoleException.class);
} }
} }

View File

@ -14,7 +14,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.BaseQuery.SortDirection; import pro.taskana.common.api.BaseQuery.SortDirection;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketAccessItemQuery; import pro.taskana.workbasket.api.WorkbasketAccessItemQuery;
@ -69,7 +69,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
.accessIdIn("user-1-1", "group-1") .accessIdIn("user-1-1", "group-1")
.list(); .list();
}; };
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "businessadmin") @WithAccessId(user = "businessadmin")

View File

@ -11,7 +11,7 @@ import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.BaseQuery.SortDirection; import pro.taskana.common.api.BaseQuery.SortDirection;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
@ -66,7 +66,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
.accessIdsHavePermissions(List.of(WorkbasketPermission.APPEND), "user-1-1") .accessIdsHavePermissions(List.of(WorkbasketPermission.APPEND), "user-1-1")
.list(); .list();
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "businessadmin") @WithAccessId(user = "businessadmin")

View File

@ -9,7 +9,7 @@ import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
@ -35,7 +35,7 @@ class WorkbasketQueryAccTest extends AbstractAccTest {
List.of(WorkbasketPermission.TRANSFER), "teamlead-1", GROUP_1_DN, GROUP_2_DN) List.of(WorkbasketPermission.TRANSFER), "teamlead-1", GROUP_1_DN, GROUP_2_DN)
.list(); .list();
}; };
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "unknownuser") @WithAccessId(user = "unknownuser")
@ -54,7 +54,7 @@ class WorkbasketQueryAccTest extends AbstractAccTest {
List.of(WorkbasketPermission.TRANSFER), "teamlead-1", GROUP_1_DN, GROUP_2_DN) List.of(WorkbasketPermission.TRANSFER), "teamlead-1", GROUP_1_DN, GROUP_2_DN)
.list(); .list();
}; };
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "businessadmin") @WithAccessId(user = "businessadmin")

View File

@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
@ -68,21 +68,21 @@ class UpdateDistributionTargetsAccTest extends AbstractAccTest {
workbasketService.setDistributionTargets( workbasketService.setDistributionTargets(
existingWb, List.of("WBI:100000000000000000000000000000000002")); existingWb, List.of("WBI:100000000000000000000000000000000002"));
}; };
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
call = call =
() -> { () -> {
workbasketService.addDistributionTarget( workbasketService.addDistributionTarget(
existingWb, "WBI:100000000000000000000000000000000002"); existingWb, "WBI:100000000000000000000000000000000002");
}; };
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
call = call =
() -> { () -> {
workbasketService.removeDistributionTarget( workbasketService.removeDistributionTarget(
existingWb, "WBI:100000000000000000000000000000000002"); existingWb, "WBI:100000000000000000000000000000000002");
}; };
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "businessadmin") @WithAccessId(user = "businessadmin")
@ -153,7 +153,7 @@ class UpdateDistributionTargetsAccTest extends AbstractAccTest {
() -> { () -> {
workbasketService.addDistributionTarget(workbasket.getId(), newTarget.getId()); workbasketService.addDistributionTarget(workbasket.getId(), newTarget.getId());
}; };
assertThatThrownBy(call).isInstanceOf(MismatchedRoleException.class); assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
} }
@WithAccessId(user = "businessadmin") @WithAccessId(user = "businessadmin")

View File

@ -13,7 +13,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.exceptions.ConcurrencyException; import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketCustomField; import pro.taskana.workbasket.api.WorkbasketCustomField;
@ -142,6 +142,6 @@ class UpdateWorkbasketAccTest extends AbstractAccTest {
workbasket.setName("new name"); workbasket.setName("new name");
assertThatThrownBy(() -> workbasketService.updateWorkbasket(workbasket)) assertThatThrownBy(() -> workbasketService.updateWorkbasket(workbasket))
.isInstanceOf(MismatchedRoleException.class); .isInstanceOf(NotAuthorizedException.class);
} }
} }

View File

@ -16,7 +16,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.KeyDomain; import pro.taskana.common.api.KeyDomain;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.task.api.TaskService; import pro.taskana.task.api.TaskService;
@ -45,7 +45,7 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
"WBI:100000000000000000000000000000000008", "newAccessIdForUpdate"); "WBI:100000000000000000000000000000000008", "newAccessIdForUpdate");
assertThatThrownBy(() -> workbasketService.updateWorkbasketAccessItem(workbasketAccessItem)) assertThatThrownBy(() -> workbasketService.updateWorkbasketAccessItem(workbasketAccessItem))
.isInstanceOf(MismatchedRoleException.class); .isInstanceOf(NotAuthorizedException.class);
} }
@Test @Test

View File

@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
import pro.taskana.common.api.TaskanaEngine; import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.api.exceptions.DomainNotFoundException; import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.internal.util.IdGenerator; import pro.taskana.common.internal.util.IdGenerator;
import pro.taskana.workbasket.api.WorkbasketType; import pro.taskana.workbasket.api.WorkbasketType;
import pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException; import pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException;
@ -52,7 +52,7 @@ public class TaskanaTestController {
public @ResponseBody String transaction( public @ResponseBody String transaction(
@RequestParam(value = "rollback", defaultValue = "false") String rollback) @RequestParam(value = "rollback", defaultValue = "false") String rollback)
throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException, throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException,
MismatchedRoleException { NotAuthorizedException {
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key", "workbasket")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key", "workbasket"));
int workbaskets = getWorkbaskets(); int workbaskets = getWorkbaskets();
@ -68,7 +68,7 @@ public class TaskanaTestController {
public @ResponseBody String transactionMany( public @ResponseBody String transactionMany(
@RequestParam(value = "rollback", defaultValue = "false") String rollback) @RequestParam(value = "rollback", defaultValue = "false") String rollback)
throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException, throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException,
MismatchedRoleException { NotAuthorizedException {
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key1", "workbasket1")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key1", "workbasket1"));
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key2", "workbasket2")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key2", "workbasket2"));
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key3", "workbasket3")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key3", "workbasket3"));
@ -85,7 +85,7 @@ public class TaskanaTestController {
public @ResponseBody String transactionCustomdb( public @ResponseBody String transactionCustomdb(
@RequestParam(value = "rollback", defaultValue = "false") String rollback) @RequestParam(value = "rollback", defaultValue = "false") String rollback)
throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException, throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException,
MismatchedRoleException { NotAuthorizedException {
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key1", "workbasket1")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key1", "workbasket1"));
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key2", "workbasket2")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key2", "workbasket2"));

View File

@ -12,7 +12,7 @@ import pro.taskana.task.api.exceptions.ObjectReferencePersistenceException;
import pro.taskana.task.api.exceptions.TaskAlreadyExistException; import pro.taskana.task.api.exceptions.TaskAlreadyExistException;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.task.internal.models.ObjectReferenceImpl; import pro.taskana.task.internal.models.ObjectReferenceImpl;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
/** TODO. */ /** TODO. */
@ -29,7 +29,7 @@ public class TaskanaComponent {
public void triggerRollback() public void triggerRollback()
throws WorkbasketNotFoundException, ClassificationNotFoundException, throws WorkbasketNotFoundException, ClassificationNotFoundException,
TaskAlreadyExistException, InvalidArgumentException, AttachmentPersistenceException, TaskAlreadyExistException, InvalidArgumentException, AttachmentPersistenceException,
ObjectReferencePersistenceException, MismatchedWorkbasketPermissionException { ObjectReferencePersistenceException, NotAuthorizedOnWorkbasketException {
Task task = taskService.newTask("1"); Task task = taskService.newTask("1");
task.setName("Unit Test Task"); task.setName("Unit Test Task");
ObjectReferenceImpl objRef = new ObjectReferenceImpl(); ObjectReferenceImpl objRef = new ObjectReferenceImpl();

View File

@ -11,7 +11,7 @@ import pro.taskana.classification.api.models.Classification;
import pro.taskana.classification.api.models.ClassificationSummary; import pro.taskana.classification.api.models.ClassificationSummary;
import pro.taskana.common.api.exceptions.DomainNotFoundException; import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.testapi.builder.EntityBuilder.SummaryEntityBuilder; import pro.taskana.testapi.builder.EntityBuilder.SummaryEntityBuilder;
public class ClassificationBuilder public class ClassificationBuilder
@ -119,7 +119,7 @@ public class ClassificationBuilder
@Override @Override
public Classification buildAndStore(ClassificationService classificationService) public Classification buildAndStore(ClassificationService classificationService)
throws InvalidArgumentException, ClassificationAlreadyExistException, DomainNotFoundException, throws InvalidArgumentException, ClassificationAlreadyExistException, DomainNotFoundException,
MalformedServiceLevelException, ClassificationNotFoundException, MismatchedRoleException { MalformedServiceLevelException, ClassificationNotFoundException, NotAuthorizedException {
try { try {
Classification c = classificationService.createClassification(testClassification); Classification c = classificationService.createClassification(testClassification);
return classificationService.getClassification(c.getId()); return classificationService.getClassification(c.getId());

View File

@ -21,7 +21,7 @@ import pro.taskana.task.api.models.ObjectReference;
import pro.taskana.task.api.models.Task; import pro.taskana.task.api.models.Task;
import pro.taskana.task.api.models.TaskSummary; import pro.taskana.task.api.models.TaskSummary;
import pro.taskana.testapi.builder.EntityBuilder.SummaryEntityBuilder; import pro.taskana.testapi.builder.EntityBuilder.SummaryEntityBuilder;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.api.models.WorkbasketSummary;
@ -217,7 +217,7 @@ public class TaskBuilder implements SummaryEntityBuilder<TaskSummary, Task, Task
throws TaskAlreadyExistException, InvalidArgumentException, WorkbasketNotFoundException, throws TaskAlreadyExistException, InvalidArgumentException, WorkbasketNotFoundException,
ClassificationNotFoundException, AttachmentPersistenceException, ClassificationNotFoundException, AttachmentPersistenceException,
ObjectReferencePersistenceException, TaskNotFoundException, ObjectReferencePersistenceException, TaskNotFoundException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
try { try {
Task task = taskService.createTask(testTask); Task task = taskService.createTask(testTask);
return taskService.getTask(task.getId()); return taskService.getTask(task.getId());

View File

@ -7,7 +7,7 @@ import pro.taskana.task.api.TaskService;
import pro.taskana.task.api.exceptions.TaskCommentNotFoundException; import pro.taskana.task.api.exceptions.TaskCommentNotFoundException;
import pro.taskana.task.api.exceptions.TaskNotFoundException; import pro.taskana.task.api.exceptions.TaskNotFoundException;
import pro.taskana.task.api.models.TaskComment; import pro.taskana.task.api.models.TaskComment;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
public class TaskCommentBuilder implements EntityBuilder<TaskComment, TaskService> { public class TaskCommentBuilder implements EntityBuilder<TaskComment, TaskService> {
@ -50,7 +50,7 @@ public class TaskCommentBuilder implements EntityBuilder<TaskComment, TaskServic
@Override @Override
public TaskComment buildAndStore(TaskService taskService) public TaskComment buildAndStore(TaskService taskService)
throws InvalidArgumentException, TaskNotFoundException, TaskCommentNotFoundException, throws InvalidArgumentException, TaskNotFoundException, TaskCommentNotFoundException,
MismatchedWorkbasketPermissionException { NotAuthorizedOnWorkbasketException {
try { try {
TaskComment t = taskService.createTaskComment(testTaskComment); TaskComment t = taskService.createTaskComment(testTaskComment);
return taskService.getTaskComment(t.getId()); return taskService.getTaskComment(t.getId());

View File

@ -3,7 +3,7 @@ package pro.taskana.testapi.builder;
import java.util.Set; import java.util.Set;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.user.api.UserService; import pro.taskana.user.api.UserService;
import pro.taskana.user.api.exceptions.UserAlreadyExistException; import pro.taskana.user.api.exceptions.UserAlreadyExistException;
import pro.taskana.user.api.models.User; import pro.taskana.user.api.models.User;
@ -91,7 +91,7 @@ public class UserBuilder implements EntityBuilder<User, UserService> {
@Override @Override
public User buildAndStore(UserService userService) public User buildAndStore(UserService userService)
throws UserAlreadyExistException, InvalidArgumentException, MismatchedRoleException { throws UserAlreadyExistException, InvalidArgumentException, NotAuthorizedException {
return userService.createUser(testUser); return userService.createUser(testUser);
} }
} }

View File

@ -1,7 +1,7 @@
package pro.taskana.testapi.builder; package pro.taskana.testapi.builder;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.workbasket.api.WorkbasketPermission; import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.exceptions.WorkbasketAccessItemAlreadyExistException; import pro.taskana.workbasket.api.exceptions.WorkbasketAccessItemAlreadyExistException;
@ -47,7 +47,7 @@ public class WorkbasketAccessItemBuilder
@Override @Override
public WorkbasketAccessItem buildAndStore(WorkbasketService workbasketService) public WorkbasketAccessItem buildAndStore(WorkbasketService workbasketService)
throws InvalidArgumentException, WorkbasketAccessItemAlreadyExistException, throws InvalidArgumentException, WorkbasketAccessItemAlreadyExistException,
WorkbasketNotFoundException, MismatchedRoleException { WorkbasketNotFoundException, NotAuthorizedException {
return workbasketService.createWorkbasketAccessItem(testWorkbasketAccessItem); return workbasketService.createWorkbasketAccessItem(testWorkbasketAccessItem);
} }
} }

View File

@ -4,12 +4,12 @@ import java.time.Instant;
import pro.taskana.common.api.exceptions.DomainNotFoundException; import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.MismatchedRoleException; import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.testapi.builder.EntityBuilder.SummaryEntityBuilder; import pro.taskana.testapi.builder.EntityBuilder.SummaryEntityBuilder;
import pro.taskana.workbasket.api.WorkbasketCustomField; import pro.taskana.workbasket.api.WorkbasketCustomField;
import pro.taskana.workbasket.api.WorkbasketService; import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.WorkbasketType; import pro.taskana.workbasket.api.WorkbasketType;
import pro.taskana.workbasket.api.exceptions.MismatchedWorkbasketPermissionException; import pro.taskana.workbasket.api.exceptions.NotAuthorizedOnWorkbasketException;
import pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException; import pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException;
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
import pro.taskana.workbasket.api.models.Workbasket; import pro.taskana.workbasket.api.models.Workbasket;
@ -115,8 +115,7 @@ public class WorkbasketBuilder
@Override @Override
public Workbasket buildAndStore(WorkbasketService workbasketService) public Workbasket buildAndStore(WorkbasketService workbasketService)
throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException, throws InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException,
WorkbasketNotFoundException, MismatchedRoleException, WorkbasketNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException {
MismatchedWorkbasketPermissionException {
try { try {
Workbasket w = workbasketService.createWorkbasket(testWorkbasket); Workbasket w = workbasketService.createWorkbasket(testWorkbasket);
return workbasketService.getWorkbasket(w.getId()); return workbasketService.getWorkbasket(w.getId());

View File

@ -28,42 +28,42 @@ Additionally, an optional set of message variables, containing some technical in
[%autowidth,width="100%"] [%autowidth,width="100%"]
|=== |===
| Status Code | Key | Message Variables | Status Code | Key | Message Variables
| *400 BAD_REQUEST* | CLASSIFICATION_SERVICE_LEVEL_MALFORMED | serviceLevel, classificationKey, domain | *400 BAD_REQUEST* | CLASSIFICATION_SERVICE_LEVEL_MALFORMED | serviceLevel, classificationKey, domain
| *400 BAD_REQUEST* | CUSTOM_HOLIDAY_WRONG_FORMAT | customHoliday | *400 BAD_REQUEST* | CUSTOM_HOLIDAY_WRONG_FORMAT | customHoliday
| *400 BAD_REQUEST* | DOMAIN_NOT_FOUND | domain | *400 BAD_REQUEST* | DOMAIN_NOT_FOUND | domain
| *400 BAD_REQUEST* | INVALID_ARGUMENT | | *400 BAD_REQUEST* | INVALID_ARGUMENT |
| *400 BAD_REQUEST* | QUERY_PARAMETER_MALFORMED | malformedQueryParameters | *400 BAD_REQUEST* | QUERY_PARAMETER_MALFORMED | malformedQueryParameters
| *400 BAD_REQUEST* | TASK_INVALID_CALLBACK_STATE | taskId, taskCallbackState, requiredCallbackStates | *400 BAD_REQUEST* | TASK_INVALID_CALLBACK_STATE | taskId, taskCallbackState, requiredCallbackStates
| *400 BAD_REQUEST* | TASK_INVALID_OWNER | taskId, currentUserId | *400 BAD_REQUEST* | TASK_INVALID_OWNER | taskId, currentUserId
| *400 BAD_REQUEST* | TASK_INVALID_STATE | taskId, taskState, requiredTaskStates | *400 BAD_REQUEST* | TASK_INVALID_STATE | taskId, taskState, requiredTaskStates
| *403 FORBIDDEN* | ROLE_MISMATCHED | roles, currentUserId | *403 FORBIDDEN* | NOT_AUTHORIZED | roles, currentUserId
| *403 FORBIDDEN* | TASK_COMMENT_CREATOR_MISMATCHED | currentUserId, taskCommentId | *403 FORBIDDEN* | NOT_AUTHORIZED_ON_TASK_COMMENT | currentUserId, taskCommentId
| *403 FORBIDDEN* | WORKBASKET_WITH_ID_MISMATCHED_PERMISSION | currentUserId, workbasketId, requiredPermissions | *403 FORBIDDEN* | NOT_AUTHORIZED_ON_WORKBASKET_WITH_ID | currentUserId, workbasketId, requiredPermissions
| *403 FORBIDDEN* | WORKBASKET_WITH_KEY_MISMATCHED_PERMISSION | currentUserId, workbasketKey, domain, requiredPermissions | *403 FORBIDDEN* | NOT_AUTHORIZED_ON_WORKBASKET_WITH_KEY_AND_DOMAIN | currentUserId, workbasketKey, domain, requiredPermissions
| *404 NOT_FOUND* | CLASSIFICATION_WITH_ID_NOT_FOUND | classificationId | *404 NOT_FOUND* | CLASSIFICATION_WITH_ID_NOT_FOUND | classificationId
| *404 NOT_FOUND* | CLASSIFICATION_WITH_KEY_NOT_FOUND | classificationKey, domain | *404 NOT_FOUND* | CLASSIFICATION_WITH_KEY_NOT_FOUND | classificationKey, domain
| *404 NOT_FOUND* | TASK_COMMENT_NOT_FOUND | taskCommentId | *404 NOT_FOUND* | TASK_COMMENT_NOT_FOUND | taskCommentId
| *404 NOT_FOUND* | TASK_NOT_FOUND | taskId | *404 NOT_FOUND* | TASK_NOT_FOUND | taskId
| *404 NOT_FOUND* | USER_NOT_FOUND | userId | *404 NOT_FOUND* | USER_NOT_FOUND | userId
| *404 NOT_FOUND* | WORKBASKET_WITH_ID_NOT_FOUND | workbasketId | *404 NOT_FOUND* | WORKBASKET_WITH_ID_NOT_FOUND | workbasketId
| *404 NOT_FOUND* | WORKBASKET_WITH_KEY_NOT_FOUND | workbasketKey, domain | *404 NOT_FOUND* | WORKBASKET_WITH_KEY_NOT_FOUND | workbasketKey, domain
| *409 CONFLICT* | ATTACHMENT_ALREADY_EXISTS | attachmentId, taskId | *409 CONFLICT* | ATTACHMENT_ALREADY_EXISTS | attachmentId, taskId
| *409 CONFLICT* | CLASSIFICATION_ALREADY_EXISTS | classificationKey, domain | *409 CONFLICT* | CLASSIFICATION_ALREADY_EXISTS | classificationKey, domain
| *409 CONFLICT* | ENTITY_NOT_UP_TO_DATE | entityId | *409 CONFLICT* | ENTITY_NOT_UP_TO_DATE | entityId
| *409 CONFLICT* | TASK_ALREADY_EXISTS | externalTaskId | *409 CONFLICT* | TASK_ALREADY_EXISTS | externalTaskId
| *409 CONFLICT* | USER_ALREADY_EXISTS | userID | *409 CONFLICT* | USER_ALREADY_EXISTS | userID
| *409 CONFLICT* | WORKBASKET_ACCESS_ITEM_ALREADY_EXISTS | accessId, workbasketId | *409 CONFLICT* | WORKBASKET_ACCESS_ITEM_ALREADY_EXISTS | accessId, workbasketId
| *409 CONFLICT* | WORKBASKET_ALREADY_EXISTS | workbasketKey, domain | *409 CONFLICT* | WORKBASKET_ALREADY_EXISTS | workbasketKey, domain
| *409 CONFLICT* | WORKBASKET_MARKED_FOR_DELETION | workbasketId | *409 CONFLICT* | WORKBASKET_MARKED_FOR_DELETION | workbasketId
| *413 PAYLOAD_TOO_LARGE* | PAYLOAD_TOO_LARGE | | *413 PAYLOAD_TOO_LARGE* | PAYLOAD_TOO_LARGE |
| *423 LOCKED* | CLASSIFICATION_IN_USE | classificationKey, domain | *423 LOCKED* | CLASSIFICATION_IN_USE | classificationKey, domain
| *423 LOCKED* | WORKBASKET_IN_USE | workbasketId | *423 LOCKED* | WORKBASKET_IN_USE | workbasketId
| *500 INTERNAL_SERVER_ERROR* | CONNECTION_AUTOCOMMIT_FAILED | | *500 INTERNAL_SERVER_ERROR* | CONNECTION_AUTOCOMMIT_FAILED |
| *500 INTERNAL_SERVER_ERROR* | CONNECTION_NOT_SET | | *500 INTERNAL_SERVER_ERROR* | CONNECTION_NOT_SET |
| *500 INTERNAL_SERVER_ERROR* | CRITICAL_SYSTEM_ERROR | | *500 INTERNAL_SERVER_ERROR* | CRITICAL_SYSTEM_ERROR |
| *500 INTERNAL_SERVER_ERROR* | DATABASE_UNSUPPORTED | databaseProductName | *500 INTERNAL_SERVER_ERROR* | DATABASE_UNSUPPORTED | databaseProductName
| *500 INTERNAL_SERVER_ERROR* | UNKNOWN_ERROR | | *500 INTERNAL_SERVER_ERROR* | UNKNOWN_ERROR |
|=== |===
==== Errors ==== Errors

Some files were not shown because too many files have changed in this diff Show More