-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Sharing: Do not show copy action when user doesn't have permissions #37802
Conversation
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.
Shouldn't the user be allowed to copy a file if he can read it?
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. |
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. |
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 |
I think this is the way to go as this is what I would expect from a dav endpoint. |
Seems like the permission error stems from here: https://github.com/nextcloud/server/blob/master/apps/dav/lib/DAV/ViewOnlyPlugin.php |
Sorry, I assumed the backend was as intended. If not, then I would agree that this is rather something to fix in the backend. :) |
@@ -94,7 +94,7 @@ import { getCapabilities } from '@nextcloud/capabilities' | |||
} | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> (1 & 2 === 0)
0
> (1 & 2) === 0
true
😡
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.
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.
/rebase |
It turns out, there was already code for this, but it didn't work. |
e327890
to
8be2c04
Compare
Citing @jancborchardt
I can haz reviews? |
/rebase |
…pdate permissions Signed-off-by: Marcel Klehr <[email protected]>
8be2c04
to
af66537
Compare
/compile |
Signed-off-by: nextcloud-command <[email protected]>
/backport to stable26 |
/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-stable25 More 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-stable26 More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport |
/backport af66537 to stable25 |
/backport af66537 to stable26 |
/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-stable27 More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport |
fixes #37729
Screencasts
Before
After
Checklist