question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support multiple roles

See original GitHub issue

From 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:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
filipeximenescommented, Mar 9, 2017

This is up on PyPI as version 2.0.0. Thanks very much for everyone’s contributions, and @kavdev for the PR.

1reaction
CarlosBorrotocommented, May 18, 2016

+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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple Roles – WordPress plugin
This plugin allows you to select multiple roles for a user – something that WordPress already supports “under the hood”, but doesn't provide...
Read more >
Add a WordPress User to Multiple Roles - PublishPress
By default, there are five users roles in WordPress: Subscriber, Contributor, Author, Editor, Administrator. However, it is possible to create new roles and...
Read more >
WordPress access control for users with multiple roles
WordPress access control for users with multiple roles. Advanced Access Manager supports multiple roles per user with version 5.5.0 or higher. Prior to...
Read more >
Assigning multiple roles to a user | Contentful Help Center
A user can be assigned with multiple space roles. Multiple roles can be assigned to a user individually or inherited from a team...
Read more >
Permissions for Multiple Roles - IBM
You can assign more than one role to a user. However, some restrictions apply when multiple roles are assigned to a user. When...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found