Saturday, 15 September 2012

python - Django User Custom Permissions without using Django Admin & Groups? -


I am using a custom user model and trying to add permission to users who manage their business Will be able to (only) profile.

I have two models that I need to connect to.

Business & amp; User

I have a four level user permit

  1 No permission 2. Employee 3. Manager 4. Owner (Owner of many businesses)  

I have to control, only In templates on my views.py where each user can see a little different content, links, etc.

The million dollar question is:

< Strong> Option 1

Am I just directly in the user model as M2M field in is_employee , is_manager and is_owner Add fields and just check when the user is logged in for permission?

Option 2 Technically, I can add those three permissible areas as is_employee , is_manager and is_owner in the form of M2M field Check for the business model in and check whether the user is authorized to access business data.

Option 3

Create any kind of central service layer (manager) functionality that will make my thoughts and model T


No comments:

Post a Comment