-
Notifications
You must be signed in to change notification settings - Fork 8
Fix file being shared with approver group even if the group already has access #52
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
base: main
Are you sure you want to change the base?
Conversation
Not sure about most efficient, but this is what is being used in the files app $uid = $this->userSession->getUser()->getUID();
$baseFolder = $this->rootFolder->getUserFolder($uid);
$files = $baseFolder->getById($fileId);
if (empty($files)) {
// not access to this fileID
} |
|
@skjnldsv Thanks for the feedback. That's also how it's done in Approval to check if one user has access to a specific file. My question is more about how to check if a group has access to a file. The implementation in this PR iterates on the group members and calls |
|
Sorry, then I'm lacking expertise! 🙈 |
|
This is needed |
|
Point 2 is also very important. As now this plugin cannot be used with single-user shared folder. In the moment the plugin asks for approve, the folder is then shared with the entire group selected in the "Who can approve" field. It would probably be better if the plugin checks for the permission without applying it automatically to the file. I should probably dig more in how the plugin works, but my suggestion is only based on my user experience. |
Approach A:
Not though about it long, but I think with this approach we might never have to iterate through the group members. Approach B (Similar to A but uses iteration as last resort):
|
901eea1 to
b52930c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
There are kind of two parts to this where the first part should be pretty fast and just checks if a group share with the correct group exists ( |
|
@nfebe would you be able to provide a review here? |
…the file with the group if it already has access Signed-off-by: Julien Veyssier <julien-nc@posteo.net> # Conflicts: # lib/Service/UtilsService.php
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
20581c2 to
a006d8a
Compare
nfebe
left a comment
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.
🐘
|
Performant part was moved to #320 which should be merged while this will be kept in case someone else wants to do further work on the slow part (sharing only with part of group when some members have access). |
|
Edited previous comment: 52 -> 320 |
When requesting approval with a rule having a group as "approver", the file is always shared with this group to make sure the group has access.
Two problems:
This PR kind of fixes 1.
We only create the file share to the group if at least one member of this group does not have access to the file.
Iterating over group members to check if they have access is not ideal performance-wise.
@skjnldsv Is there a more efficient way to check if a group has access to a file (via a group folder, a file share or anything else)?
cc @blizzz