-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closes #2269 - Implement READTASKS Permission #2285
Conversation
ddf27ea
to
d815270
Compare
7e218fb
to
696d2de
Compare
4421a22
to
57e3441
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests for WorkbasketService and WorkbasketQuery.
lib/taskana-core-test/src/test/java/acceptance/task/get/GetTaskAccTest.java
Outdated
Show resolved
Hide resolved
lib/taskana-core-test/src/test/java/acceptance/task/query/TaskQueryImplAccTest.java
Outdated
Show resolved
Hide resolved
lib/taskana-core-test/src/test/java/acceptance/task/query/TaskQueryImplAccTest.java
Show resolved
Hide resolved
lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskServiceImpl.java
Outdated
Show resolved
Hide resolved
lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketQueryMapper.java
Outdated
Show resolved
Hide resolved
lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketQueryMapper.java
Outdated
Show resolved
Hide resolved
lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketQueryMapper.java
Outdated
Show resolved
Hide resolved
lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketQueryMapper.java
Outdated
Show resolved
Hide resolved
lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketQueryMapper.java
Outdated
Show resolved
Hide resolved
lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketQueryMapper.java
Outdated
Show resolved
Hide resolved
f40cfef
to
f1bf816
Compare
lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskServiceImpl.java
Outdated
Show resolved
Hide resolved
ae3d6c7
to
54e5705
Compare
lib/taskana-core-test/src/test/java/acceptance/task/query/TaskQueryImplAccTest.java
Outdated
Show resolved
Hide resolved
|
||
@WithAccessId(user = "user-1-1") | ||
@Test | ||
void should_ThrowException_When_WorkbasketOfTaskHasReadTasksButNoReadPerm() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test doesn't throw an exception, please rename it
lib/taskana-core-test/src/test/java/acceptance/task/query/TaskQueryImplAccTest.java
Show resolved
Hide resolved
lib/taskana-core-test/src/test/java/acceptance/task/query/TaskQueryImplAccTest.java
Show resolved
Hide resolved
lib/taskana-core-test/src/test/java/acceptance/task/query/TaskQueryImplAccTest.java
Outdated
Show resolved
Hide resolved
lib/taskana-core-test/src/test/java/acceptance/task/query/TaskQueryImplAccTest.java
Outdated
Show resolved
Hide resolved
...a-core/src/test/java/acceptance/workbasket/update/UpdateWorkbasketAuthorizationsAccTest.java
Outdated
Show resolved
Hide resolved
theAccessItem.setPermission(WorkbasketPermission.READTASKS, false); | ||
workbasketService.updateWorkbasketAccessItem(theAccessItem); | ||
|
||
List<WorkbasketAccessItem> accessItems2 = workbasketService.getWorkbasketAccessItems(wbId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gitgoodjhe after updating Permission Workbasket Access Item, should the Access Item be queried again to check if Permission is updated? In other tests, access items are queried again, which actually is not needed.
|
||
@WithAccessId(user = "user-1-1") | ||
@Test | ||
void should_QueryByTaskId_When_WorkbasketHasReadAndReadTasksButNoOpenPerm() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe another test with a query for task7 and task8 makes sense, making sure that only task8 is returned?
@@ -117,7 +117,8 @@ public static String queryTaskSummariesDb2() { | |||
+ "s.ACCESS_ID IN " | |||
+ "(<foreach item='item' collection='accessIdIn' separator=',' >#{item}</foreach>) " | |||
+ "and " | |||
+ "s.WORKBASKET_ID = X.WORKBASKET_ID AND s.perm_read = 1 fetch first 1 rows only" | |||
+ "s.WORKBASKET_ID = X.WORKBASKET_ID AND s.perm_read = 1 AND s.perm_readtasks = 1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it would have been sufficient to only check the readtasks permission, to keep the complexity small. But in this case it does not increase the complexity too much, or what do you think?
@@ -97,6 +97,20 @@ void should_GetAllTransferTargetsForUserAndGroup_When_QueryingForMultiplePermiss | |||
assertThat(results).hasSize(4); | |||
} | |||
|
|||
@WithAccessId(user = "businessadmin") | |||
@Test | |||
void should_GetAllTransferTargetsForUserAndGroup_When_QueryingForReadTasksPermissions() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is wrong, isn't it? Why "TransferTargets"?
@@ -160,6 +174,18 @@ void should_GetAllTransferTargetsForSubjectUser_When_QueryingForSinglePermission | |||
assertThat(results).hasSize(1); | |||
} | |||
|
|||
@WithAccessId(user = "user-1-1") | |||
@Test | |||
void should_GetAllTransferTargetsForSubjectUser_When_QueryingForReadTasksPermission() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
Great work, well done! @jamesrdi |
https://sonarcloud.io/summary/new_code?id=jamesrdi_taskana&branch=TSK-2269
Release Notes:
For the submitter:
Verified by the reviewer: