Support multiple roles
See original GitHub issueFrom what I’ve seen in the code, it seems that though the app could support multiple roles per user, it supports only one.
For example assign_role_to_user will delete all of the user’s previous roles:
https://github.com/vintasoftware/django-role-permissions/blob/master/rolepermissions/roles.py#L50
And get_user_role explicitely return only the first role if the user has multiple roles:
https://github.com/vintasoftware/django-role-permissions/blob/74ad8cc3d3983e9661658b28e217b2bbab086373/rolepermissions/shortcuts.py#L21
Is there a reason for not supporting multiple roles? Before diving into the code, I would like to have an idea on how difficult could implementing such a feature be ? Would a PR working towards implementing this feature be considered?
Thanks.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:17 (8 by maintainers)

Top Related StackOverflow Question
This is up on PyPI as version 2.0.0. Thanks very much for everyone’s contributions, and @kavdev for the PR.
+1 for multiple roles support.
Not my use case but I think a good example in support of multiple rules. In a school environment I can see a user playing several of these roles.
Roles: Principal, Teacher, Teacher Assistant, Admin Staff, Staff, Student