0

i want to make a django application and for a security reasons, i have three types of users (admins, teachers , and students)

i want to make a subdomain for each type of users

users.domain.com

teachers.domain.com

admins.domain.com

after the loggin i want to switch to a specific database user for each subdomain (the same database)

I m new to django and i want some help to do this

Thanks

bouchnina
  • 11
  • 1
  • 4
  • Do you want to switch user on subdomain depending of the user`s type? – Nuchimik Feb 11 '21 at 14:36
  • as i understand from your question , yes i have three types of users , each one have a specific subdomains i want to switch to another database user for each subdomain ( type of users) – bouchnina Feb 11 '21 at 14:46
  • I do not know how to implement this, it is rather very hard, but why would you want to do this? It is not practical and I am wondering what this would give you? – katek1094 Feb 11 '21 at 14:54
  • @katek1094 I think the opposite should happen. If a user tries to log in other domain, he should be switched to the correct domain – Nuchimik Feb 11 '21 at 14:56
  • for example the students will have a database user that doesnt have acces to update certain tables ( for security purposes) so each type of users will have a database user granted with the necessary database privilleges – bouchnina Feb 11 '21 at 15:07
  • What are you using for web hosting and serving the web application? You'll need to handle this at that level, before Django ever gets involved. One way would be to change the database access environment variable(s) based on the subdomain. – schillingt Feb 11 '21 at 15:42
  • Hi @bouchnina. Thank you for the question. I am having exactly issue as yours due to the new data law GDPR that is currently enforced in EU. Therefore, to let other developers know, we will have to get used to do what the question is asking because there will have less implementation with multiple tenants at the same database. Nevertheless, I would like to know what was your solution for this question @bouchnina? Thank you. – Elias Prado Mar 29 '22 at 22:07

0 Answers0