2

I have 4 types of users

Superuser
Customer
Staff User
Vendor

I problem which i face right now is only one type of user is authenticated using django authentication system at a particular moment.

How can i have multiple authentication systems for different types of users?

asing177
  • 934
  • 2
  • 13
  • 34
  • 1
    [Duplicate of the question below this one](http://stackoverflow.com/q/35775374/1324033) – Sayse Mar 03 '16 at 15:19
  • is it like that....its not about profiles...i want mutiple users to log into the system at a moment but areas of access must be defined for a particular user....the problem here is when i login from a form it logs that user everywhere on the system.the above meantioned are the 4 areas in my system – asing177 Mar 04 '16 at 09:46

1 Answers1

1

I think you should have just one user model with some tags indicating which type is each one, and then adjust your app to this as it is explained in the section "Limiting access to logged-in users that pass a test": https://docs.djangoproject.com/en/1.9/topics/auth/default/#the-login-required-decorator

Maybe this could help too: https://docs.djangoproject.com/en/1.9/topics/auth/default/#topic-authorization

Andres Espinosa
  • 402
  • 7
  • 14
  • but what happens is when use user.is_authenticated() method the user which is authenticated logs in....my superuser logs into anywhere on the website – asing177 Mar 03 '16 at 15:53
  • how can i make my superuser to stop log into other parts of the website...and similarly for other users...How can i set access areas for different users? – asing177 Mar 03 '16 at 16:01
  • Look at the section Limiting access to logged-in users that pass a test: https://docs.djangoproject.com/en/1.9/topics/auth/default/#the-login-required-decorator – Andres Espinosa Mar 03 '16 at 16:05
  • this links are now broken: docs.djangoproject.com/en/1.9/topics/auth/default/… and https://docs.djangoproject.com/en/1.9/topics/auth/default/#topic-authorization – mrpepo877 Nov 25 '21 at 06:41