Uh oh!
There was an error while loading. Please reload this page.
Sharing: Do not show copy action when user doesn't have permissions - #37802
Conversation
artonge
left a comment
There was a problem hiding this comment.
Shouldn't the user be allowed to copy a file if he can read it?
marcelklehr
commented
Apr 19, 2023
In the end it's a philosophical question, I guess. Currently, the back-end does not allow this and Jan opined in the relevant ticket, that we should hide the option. |
artonge
commented
Apr 19, 2023
No, it is rather technical. If I can read the file, then copying is possible, either by copy-pasting, or if the software allows it, with one click. I also just check and Nautilus is allowing copying read-only files. Same with bash. |
marcelklehr
commented
Apr 19, 2023
I agree, this is the technical perspective. There is a UX perspective to this in a way. But personally, I'm very unconcerned by which way this goes. Either we fix this in the UI and don't show the option, or we fix it in the backend to make it possible to copy files when the user has read permissions. I'll let you fight this out with @jancborchardt |
skjnldsv
commented
Apr 19, 2023
I think this is the way to go as this is what I would expect from a dav endpoint. |
marcelklehr
commented
Apr 25, 2023
Seems like the permission error stems from here: https://github.com/nextcloud/server/blob/master/apps/dav/lib/DAV/ViewOnlyPlugin.php |
jancborchardt
commented
Apr 26, 2023
Sorry, I assumed the backend was as intended. If not, then I would agree that this is rather something to fix in the backend. :) |
| if (_.isFunction(fileData.canDownload) && !fileData.canDownload()) { | ||
| delete fileActions.actions.all.Download | ||
| if (fileData.permissions & OC.PERMISSION_UPDATE === 0) { | ||
| if ((fileData.permissions & OC.PERMISSION_UPDATE) === 0) { |
There was a problem hiding this comment.
> (1 & 2 === 0)
0
> (1 & 2) === 0
true
😡
There was a problem hiding this comment.
I always feel we do not put enough parenthesis in Nextcloud code, I tend to be paranoid about these things. There are so many operators it’s too hard to remember all priorities by heart.
marcelklehr
commented
Apr 28, 2023
/rebase |
marcelklehr
commented
Apr 28, 2023
It turns out, there was already code for this, but it didn't work. |
e327890 to
8be2c04Comparemarcelklehr
commented
May 2, 2023
Citing @jancborchardt
I can haz reviews? |
marcelklehr
commented
May 2, 2023
/rebase |
…pdate permissions Signed-off-by: Marcel Klehr <mklehr@gmx.net>
marcelklehr
commented
May 2, 2023
/compile |
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
marcelklehr
commented
Jun 7, 2023
/backport to stable26 |
marcelklehr
commented
Jun 7, 2023
/backport to stable25 |
The backport to stable25 failed. Please do this backport manually. # Switch to the target branch and update it
git checkout stable25
git pull origin/stable25
# Create the new backport branch
git checkout -b fix/foo-stable25
# Cherry pick the change from the commit sha1 of the change against the default branch# This might cause conflicts. Resolve them.
git cherry-pick abc123
# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable25More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport |
The backport to stable26 failed. Please do this backport manually. # Switch to the target branch and update it
git checkout stable26
git pull origin/stable26
# Create the new backport branch
git checkout -b fix/foo-stable26
# Cherry pick the change from the commit sha1 of the change against the default branch# This might cause conflicts. Resolve them.
git cherry-pick abc123
# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable26More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport |
marcelklehr
commented
Jun 7, 2023
/backport af66537 to stable25 |
marcelklehr
commented
Jun 7, 2023
/backport af66537 to stable26 |
solracsf
commented
Jun 7, 2023
/backport to stable27 |
The backport to stable27 failed. Please do this backport manually. # Switch to the target branch and update it
git checkout stable27
git pull origin/stable27
# Create the new backport branch
git checkout -b fix/foo-stable27
# Cherry pick the change from the commit sha1 of the change against the default branch# This might cause conflicts. Resolve them.
git cherry-pick abc123
# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable27More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport |
fixes#37729
Screencasts
Before

After

Checklist