Skip to content
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

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

jamesrdi
Copy link
Contributor

@jamesrdi jamesrdi commented Jun 2, 2023

https://sonarcloud.io/summary/new_code?id=jamesrdi_taskana&branch=TSK-2269


Release Notes:


For the submitter:

Verified by the reviewer:

@jamesrdi jamesrdi force-pushed the TSK-2269 branch 2 times, most recently from ddf27ea to d815270 Compare June 6, 2023 09:17
@jamesrdi jamesrdi force-pushed the TSK-2269 branch 3 times, most recently from 4421a22 to 57e3441 Compare June 6, 2023 11:03
Copy link
Contributor

@ryzheboka ryzheboka left a 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.

@jamesrdi jamesrdi force-pushed the TSK-2269 branch 2 times, most recently from f40cfef to f1bf816 Compare June 9, 2023 08:05
@jamesrdi jamesrdi force-pushed the TSK-2269 branch 2 times, most recently from ae3d6c7 to 54e5705 Compare June 9, 2023 08:35

@WithAccessId(user = "user-1-1")
@Test
void should_ThrowException_When_WorkbasketOfTaskHasReadTasksButNoReadPerm() {
Copy link
Contributor

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

theAccessItem.setPermission(WorkbasketPermission.READTASKS, false);
workbasketService.updateWorkbasketAccessItem(theAccessItem);

List<WorkbasketAccessItem> accessItems2 = workbasketService.getWorkbasketAccessItems(wbId);
Copy link
Contributor Author

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() {
Copy link
Contributor

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"
Copy link
Contributor

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()
Copy link
Contributor

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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

@gitgoodjhe
Copy link
Contributor

Great work, well done! @jamesrdi

@jamesrdi jamesrdi merged commit 3f25e27 into Taskana:new-permissions Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants