Reputation: 14254
I will be creating an intranet site with multiple roles (client-employee, client-admin, staff team member). Each role will have a model that attaches (via One-to-One or ForeignKey field) to a user with custom fields. I want each role to have it's own set of permissions (like a group).
How can I store this permissions set inside my application. Groups seem to be defined as part of the contrib.admin app rather than in code. I couldn't find anything in documentation on how to define a group.
What is the best way to handle model level permissions. Maybe I could do a check in the model if see if the user has the right role-model.
Upvotes: 1
Views: 565
Reputation: 188064
Access control lists are tricky (some say dead), but Django comes with a good default implementation in contrib.auth
equipped with:
A more detailed introduction can be found here:
Upvotes: 1