Skip to content

Permission case issues with CustomUser #132

@FeralRobot

Description

@FeralRobot

Running` django 2.2.5 with django-role-permissions with the django default user - I can define an "Admin" role and logging into the django admin with that "Admin" role, I can view the set of Users that "Admin" role has permission to view.

Default User
roles.py                   permission generated                            permission required
'view_user'                    'View User'                                           'View User'     (apparently)

Now I update the application to use a CustomUser model. My template/admin/index.html stops working when using rolepermission template tags, specifically has_role, meaning the "Admin" role can no longer view Users (for example). has_role is still returning true though, so eventually I look at permissions. In the django admin change user form, I discover the User permissions have changed and I can bring back the views by manually adding the permission 'Can view user', note that only the first word in this permission is capitalized.

Custom User
roles.py                   permission generated                            permission required
'Can_view_user'            'Can View User'                                     'Can view user'     (apparently)

So I am unable to generate the required permissions with django-role-permissions for the groups that I am using in my application. In that application I'm using groups generated by roles.py to assign permissions for all user types. So this is a breaking change for me.

I am using the RolePermissionsUserAdmin to create the CustomAdmin, though I had to move the code into my application because I had a CustomUserAdmin in my app as well, and I needed all the UserAdmin customizations in one place.

Any suggestions about how I could generate the required permission capitalization 'Can view user', or is there some way to configure django to have case insensitive permissions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions