In a multitenant system that hosts multiple organizations and applications, where an organization may use several applications hosted on the system, should my user and role model be such that a single user or role can exist across multiple applications and organizations? Or should I limit a user entity to a single organization/application pair and then define some overarching model to tie those user entities together?
That is:
John Doe is a person
He wants to use ApplicationA and ApplicationB
He works for two different companies (just bear with me), OrganizationA and OrganizationB
Should the user model be:
johndoe@someuniquesuffix is his unique user name. This gives him access to both applications for both organizations.
johndoe@applicationa@organizationa is his username for ApplicationA at OrganizationA. johndoe@applicationb@organizationa is his username for ApplicationB at OrganizationA...and the same for OrganizationB. Then have some "master" list that says that all 4 user accounts for the apps/orgs correspond to the same actual "person", John Doe?
The same scenario(s) described above applies to how I will design my Role schema.
Thanks for any asistance!