简体   繁体   中英

Software as a service in Django - many companies should be able to have the same users

Workflow:

  1. User in registration form gives his email, password and company name. The company with the same name is automatically creates during registration process(model Company ). This user is automatically admin of this company(in User model I have role field).

  2. Company admin can invite candidates. In form gives candidate email, first and last name. Application sends an email with activation link to candidate.

  3. The candidate by clicking the link is transfered to the page with form where sets his password and is redirected to login page

  4. Candidate can log in and add new items to database(model Item )

The problem is that many companies should be able to have the same user(the same email address). Currently application returns that email is already in use(in other company but it can't be like that). So this is something like Software as a Service. Any ideas how to solve this problem?

The solution is to have a ManyToMany relation between User and Company.

All Users are admin of their own Company (happens when they create their account), but in addition they are also candidates of other companies.

They can add Items for all companies they are in, but only invite new people for the company they're owner of, all using the same user account.

You'll need some way to switch the company they're currently working as, or showing all of them on the same screen, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM