Skip to content

Edit link on ModelAdmin index view without edit permissions #26

@srtab

Description

@srtab

Issue Summary

Edit link added to ModelAdmin index view when I remove edit permissions is causing a permission denied redirect.

Steps to Reproduce

  1. Added a wagtail_hooks.py with ModelAdmin configurations;
  2. Override PermissionHelper to not allow editions;
  3. Configured ModelAdmin to allow inspect view;
  4. Go to wagtail admin interface and open index view of added ModelAdmin;
  5. Click on link added on first column content (not the buttons) and you will be redirected to permission denied page.

I think that the correct behavior here will be replacing the edit link of first column content with the inspect link instead. And in case I haven't inspect view enabled, shouldn't add link at all to avoid the permission denied redirect.

  • I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: yes

Technical details

  • Python version: 3.9.
  • Django version: 3.2.
  • Wagtail version: 2.15.1.
  • Browser version: Chrome 96.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions