Skip to content

fix: Ensure edit permissions are checked before template file token generation#4698

Merged
juliusknorr merged 2 commits into
nextcloud:mainfrom
IONOS-Productivity:fix/respect_edit_groups_for_templates
May 23, 2025
Merged

fix: Ensure edit permissions are checked before template file token generation#4698
juliusknorr merged 2 commits into
nextcloud:mainfrom
IONOS-Productivity:fix/respect_edit_groups_for_templates

Conversation

@printminion-co
Copy link
Copy Markdown
Contributor

@printminion-co printminion-co commented Apr 25, 2025

Summary

This PR ensures that edit permissions are properly checked before generating template file tokens. Without this check, files created from templates can be edited by users with read-only permissions.

Problem

Currently, users without edit permissions can edit documents created via the "new template document" feature. This behavior violates the intended permission restrictions.

Proposed Fix

The fix ensures that edit permissions are validated before token generation, preventing unauthorized edits. This approach is similar to the fix implemented in commit 3b3c31f.

Observed Behavior (Before Fix)

Users without edit permissions can edit documents created from templates.

nc-richdocuments-readony-template-bug-2025-04-25_11.52.58.webm

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Documentation (manuals or wiki) has been updated or is not required

Comment thread lib/TokenManager.php Outdated
Copy link
Copy Markdown
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

Thanks for your PR, I left a comment for the integration test failures, the cypress failures should be fixed after a rebase

@juliusknorr juliusknorr added bug Something isn't working 2. developing Work in progress labels Apr 29, 2025
@printminion-co printminion-co force-pushed the fix/respect_edit_groups_for_templates branch from 46e2fa8 to 69900b1 Compare May 5, 2025 08:07
@printminion-co
Copy link
Copy Markdown
Contributor Author

Thanks for your PR, I left a comment for the integration test failures, the cypress failures should be fixed after a rebase

rebased

@printminion-co printminion-co force-pushed the fix/respect_edit_groups_for_templates branch 2 times, most recently from 999b7cf to 572d57a Compare May 7, 2025 08:24
@github-actions
Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@printminion-co printminion-co force-pushed the fix/respect_edit_groups_for_templates branch from 572d57a to 89ff3a7 Compare May 12, 2025 07:40
@juliusknorr
Copy link
Copy Markdown
Member

@printminion-co The comment in #4698 (comment) is still pending as far as I see. Do you need any further help to resolve on the test failure?

@printminion-co
Copy link
Copy Markdown
Contributor Author

@printminion-co The comment in #4698 (comment) is still pending as far as I see. Do you need any further help to resolve on the test failure?

@juliusknorr I answered in original comment thread

@printminion-co printminion-co force-pushed the fix/respect_edit_groups_for_templates branch from 89ff3a7 to 9222570 Compare May 19, 2025 08:15
@juliusknorr
Copy link
Copy Markdown
Member

I'll check again locally as discussed in the call

printminion-co and others added 2 commits May 23, 2025 14:09
…eneration

otherwise file created from template will be editable for user with readonly permissions

Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
Co-authored-by: Julius Knorr <jus@bitgrid.net>
Signed-off-by: Mikhailo Matiyenko-Kupriyanov <145785698+printminion-co@users.noreply.github.com>
@printminion-co printminion-co force-pushed the fix/respect_edit_groups_for_templates branch from 0aa4ba6 to 7878dd3 Compare May 23, 2025 12:09
@juliusknorr juliusknorr merged commit 1f483fc into nextcloud:main May 23, 2025
68 checks passed
@juliusknorr
Copy link
Copy Markdown
Member

/backport to stable31

@juliusknorr
Copy link
Copy Markdown
Member

/backport to stable30

@juliusknorr
Copy link
Copy Markdown
Member

/backport to stable29

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

Labels

2. developing Work in progress bug Something isn't working feedback-requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants