Only share to users and groups when necessary#389
Conversation
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
eb64f80 to
e6d4c2b
Compare
lib/Service/ApprovalService.php
Outdated
| $success = true; | ||
| foreach ($groupMembersThatNeedAccess as $groupMemberId) { | ||
| if (!$this->utilsService->createShare($node, IShare::TYPE_USER, $groupMemberId, $fileOwner, $label)) { | ||
| $success = false; | ||
| } | ||
| } | ||
| if ($success) { | ||
| $createdShares[] = $approver; | ||
| } |
There was a problem hiding this comment.
This does not make sense to me. If one group member fails, all are failed?
But I also checked, the return value of shareWithApprovers is never used, can we get rid of it entirely?
There was a problem hiding this comment.
I just removed createdShares as it is not needed anyway
julien-nc
left a comment
There was a problem hiding this comment.
If some people already have access, we don't create a group share but user shares. But then, if a user is added to the "approver" group, this user won't have access to the file that they are allowed to approve.
Not sure how to deal with that limitation but it's worth mentioning it in the README. Wdyt?
It seems like a lot of users wanted the behavior with sharing with individuals instead when it makes sense, but mentioning it in the README is a good idea. |
9ab7288 to
698cbcd
Compare
…overs Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
698cbcd to
fb7da39
Compare
|
I agree, mentioning it in the README totally makes sense. I can't really judge how the app is used, I totally can see use cases that would require one or the other. Besides listening on group changes and checking access, the only other idea would be to still create a group share and for those who already have access, to leave the share (if I understand it correctly for that USERGROUP share permission is set to 0). That would prevent double shares and new users would still gain access (which then could be result in a double share for that new user). Is it better? No idea. |
|
Did the following test:
Before this PR on the first ( After this PR on the first ( The second request ( approval/lib/Service/ApprovalService.php Lines 765 to 820 in fb7da39 Maybe we could do a similar thing there. Otherwise from what I can judge, looks good to me. |
I'll look at that in a new pr. |
|
/backport to stable32 |
Different method than #52 that gets all users that have access to a file first and then updates the shares based on that. Thanks @SystemKeeper