Skip to content

fix: allow renaming files with just update permissions#57374

Merged
icewind1991 merged 4 commits intomasterfrom
rename-dav-permissions
Mar 26, 2026
Merged

fix: allow renaming files with just update permissions#57374
icewind1991 merged 4 commits intomasterfrom
rename-dav-permissions

Conversation

@icewind1991
Copy link
Member

@icewind1991 icewind1991 commented Jan 6, 2026

Only moving to another folder needs the delete+create permissions, for moving in the same folder just update is enough.

TODO:

  • Update files webui permissions check

@icewind1991 icewind1991 added the 2. developing Work in progress label Jan 6, 2026
@icewind1991
Copy link
Member Author

/compile

@icewind1991 icewind1991 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jan 6, 2026
@icewind1991 icewind1991 added this to the Nextcloud 33 milestone Jan 6, 2026
@icewind1991 icewind1991 marked this pull request as ready for review January 6, 2026 16:37
@icewind1991 icewind1991 requested review from a team and skjnldsv as code owners January 6, 2026 16:37
@icewind1991 icewind1991 requested review from Altahrim, ArtificialOwl, leftybournes, provokateurin, susnux and szaimen and removed request for a team January 6, 2026 16:37
Copy link
Contributor

@szaimen szaimen left a comment

Choose a reason for hiding this comment

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

🐘

@nextcloud-bot nextcloud-bot mentioned this pull request Jan 7, 2026
@icewind1991
Copy link
Member Author

(I'll rebase etc once reviewed)

@nextcloud-bot nextcloud-bot mentioned this pull request Jan 9, 2026
Copy link
Contributor

@mgallien mgallien left a comment

Choose a reason for hiding this comment

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

tested with the desktop client and works fine

@icewind1991 icewind1991 force-pushed the rename-dav-permissions branch from 0f7b6d9 to de3587d Compare January 9, 2026 20:30
@nextcloud-bot nextcloud-bot mentioned this pull request Jan 14, 2026
@mgallien
Copy link
Contributor

@icewind1991 will this change be backported to stable branches ?

@nextcloud-bot nextcloud-bot mentioned this pull request Jan 20, 2026
@icewind1991 icewind1991 force-pushed the rename-dav-permissions branch from de3587d to 8a6bf8a Compare January 20, 2026 17:50
@blizzz blizzz modified the milestones: Nextcloud 33, Nextcloud 34 Feb 16, 2026
mgallien

This comment was marked as outdated.

Copy link
Contributor

@mgallien mgallien left a comment

Choose a reason for hiding this comment

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

wrong test with only partial patch applied
I can confirm that this is working fine when applied on 30.0.11

@icewind1991 icewind1991 force-pushed the rename-dav-permissions branch 5 times, most recently from 4118102 to ed3f042 Compare March 16, 2026 16:54
@icewind1991
Copy link
Member Author

/compile

Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

Makes sense but would it not make more sense to directly expose the permission in the backend?

Comment on lines +44 to +45
Boolean(node.permissions & Permission.DELETE)
&& Boolean(parentPermissions & Permission.CREATE)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it not better to move the logic to the backend?

public static function getDavPermissions(FileInfo $info): string {

Copy link
Member Author

Choose a reason for hiding this comment

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

Added the proper rename logic to the dav permissions.

But the permissions on the js side there is the numeric permissions mask (instead of the string flags), which doesn't distinguish the permissions.

Solving this would need changes in @nextcloud/files I think

Signed-off-by: Robin Appelman <robin@icewind.nl>
Signed-off-by: Robin Appelman <robin@icewind.nl>
@icewind1991 icewind1991 force-pushed the rename-dav-permissions branch 2 times, most recently from 069ced4 to cdf9368 Compare March 26, 2026 16:30
@icewind1991
Copy link
Member Author

/compile

@icewind1991 icewind1991 force-pushed the rename-dav-permissions branch from c6e04cc to 13934cf Compare March 26, 2026 17:07
icewind1991 and others added 2 commits March 26, 2026 18:18
Signed-off-by: Robin Appelman <robin@icewind.nl>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@icewind1991 icewind1991 force-pushed the rename-dav-permissions branch from 13934cf to 8f7b0b4 Compare March 26, 2026 17:19
@icewind1991 icewind1991 merged commit d1fd735 into master Mar 26, 2026
235 of 271 checks passed
@icewind1991 icewind1991 deleted the rename-dav-permissions branch March 26, 2026 21:12
@icewind1991
Copy link
Member Author

/backport to stable33

@icewind1991
Copy link
Member Author

/backport to stable32

@saw-jan
Copy link

saw-jan commented Mar 27, 2026

This breaks the existing usage of DavUtil::getDavPermissions(...) in other apps
Example in https://github.com/nextcloud/integration_openproject/blob/253c6d0d1b8ba4c8ea0bd965ba7442c2117efbfe/lib/Controller/FilesController.php#L293

App will work fine with NC 33.0.1, but after upgrade to future version NC 33.0.2 (includes this changes), app will fail.

{
  "ocs": {
    "meta": {
      "status":"failure",
      "statuscode":996,
      "message":"Internal Server Error\nToo few arguments to function OCP\\Files\\DavUtil::getDavPermissions(), 1 passed in \/var\/www\/html\/custom_apps\/integration_openproject\/lib\/Controller\/FilesController.php on line 293 and exactly 2 expected in file '\/var\/www\/html\/lib\/public\/Files\/DavUtil.php' line 37",
      "totalitems":"",
      "itemsperpage":""
    },
  "data":[]
  }
}

upgrading in patch level breaks the code.
Ref: #59241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unable to rename files in shared folders without delete permission

8 participants