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

Adds a new custom permission that will show in the user admin. #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ollz272
Copy link

@ollz272 ollz272 commented Oct 25, 2022

Im not sure when this bug occurred, but at the moment its not possible to see the enable_2fa permission in the groups admin. This is because of this bit of wagtail code:

    for content_type_id in content_type_ids:
        content_perms = permissions.filter(content_type_id=content_type_id)
        content_perms_dict = {}
        custom_perms = []

        if content_perms[0].content_type.name == "admin":
            perm = content_perms[0]
            other_perms.append((perm, checkboxes_by_id[perm.id]))
            continue

https://github.com/wagtail/wagtail/blob/main/wagtail/users/templatetags/wagtailusers_tags.py#L55-L65

Essentially, it only grabs the first permission for the admin content type. So the one for Wagtail 2FA gets left out.
For a project im working on i've had to create some custom permissions and middleware to get around this. But i believe we can fix it here.

I've simply created a new permission under the wagtail_2fa contentype. This means it will be treated like any other custom permission to wagtail and show in the admin.

@ollz272
Copy link
Author

ollz272 commented Oct 25, 2022

Related to issue #118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant