Skip to content
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

Snippets title-column always links to "edit" page #11906

Open
LCMJ21 opened this issue Apr 29, 2024 · 0 comments
Open

Snippets title-column always links to "edit" page #11906

LCMJ21 opened this issue Apr 29, 2024 · 0 comments

Comments

@LCMJ21
Copy link

LCMJ21 commented Apr 29, 2024

Issue Summary

Even if a user does not have the "change" permission, the SnippetViewSet still renders a link to the EditView, which then results in a permission error for this user. For example, we often use SnippetViewSet and use inspect_view_enabled = True and only allow inspect.

Falling back to the inspect view, if it has been enabled, and not defining a link if none of the others are available, seems a good way to solve it.

Steps to Reproduce

  1. Add a wagtail_hooks.py and register a SnippetViewSet
  2. Create a custom ModelPermissionPolicy and make user_has_permission return false if action==change
  3. Redefined the permission_policy property in your SnippetViewSet to use your ModelPermissionPolicy

Technical details

  • Django version: 5.0.3
  • Wagtail version: 6.0.1
  • Browser version: You can use Chrome 123 to find this out.
@LCMJ21 LCMJ21 added status:Unconfirmed Issue, usually a bug, that has not yet been validated as a confirmed problem. type:Bug labels Apr 29, 2024
@laymonage laymonage added component:Permissions and removed status:Unconfirmed Issue, usually a bug, that has not yet been validated as a confirmed problem. labels May 8, 2024
@laymonage laymonage self-assigned this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔖 Ready
Development

No branches or pull requests

2 participants