TSK-1441: Enable Admin to complete tasks already claimed by other users
This commit is contained in:
parent
5ddb81a618
commit
81b89e1c08
|
|
@ -1247,7 +1247,8 @@ public class TaskServiceImpl implements TaskService {
|
||||||
.getEngine()
|
.getEngine()
|
||||||
.getCurrentUserContext()
|
.getCurrentUserContext()
|
||||||
.getAccessIds()
|
.getAccessIds()
|
||||||
.contains(task.getOwner())) {
|
.contains(task.getOwner())
|
||||||
|
&& !taskanaEngine.getEngine().isUserInRole(TaskanaRole.ADMIN)) {
|
||||||
throw new InvalidOwnerException(
|
throw new InvalidOwnerException(
|
||||||
String.format(
|
String.format(
|
||||||
"Owner of task %s is %s, but current user is %s ",
|
"Owner of task %s is %s, but current user is %s ",
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,18 @@ class CompleteTaskAccTest extends AbstractAccTest {
|
||||||
assertThat(completedTask.getModified()).isNotEqualTo(completedTask.getCreated());
|
assertThat(completedTask.getModified()).isNotEqualTo(completedTask.getCreated());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@WithAccessId(user = "admin")
|
||||||
|
@Test
|
||||||
|
void should_completeClaimedTaskByAnotherUser_When_UserIsAdmin() throws Exception {
|
||||||
|
assertThat(TASK_SERVICE.getTask("TKI:000000000000000000000000000000000029").getState())
|
||||||
|
.isEqualTo(TaskState.CLAIMED);
|
||||||
|
Task completedTask = TASK_SERVICE.completeTask("TKI:000000000000000000000000000000000029");
|
||||||
|
assertThat(completedTask).isNotNull();
|
||||||
|
assertThat(completedTask.getCompleted()).isNotNull();
|
||||||
|
assertThat(completedTask.getState()).isEqualTo(TaskState.COMPLETED);
|
||||||
|
assertThat(completedTask.getModified()).isNotEqualTo(completedTask.getCreated());
|
||||||
|
}
|
||||||
|
|
||||||
@WithAccessId(user = "admin")
|
@WithAccessId(user = "admin")
|
||||||
@WithAccessId(user = "taskadmin")
|
@WithAccessId(user = "taskadmin")
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue