-
Notifications
You must be signed in to change notification settings - Fork 30
Merge User, Organization and Team models into a new Principal model #91
Comments
|
@Mitesh this ties into our previous discussion on automatic team membership based on email domain. The membership is to a team within the organization, not to the organization itself, since organizations have no concept of members. Therefore, a team within the organization is assigned the permission, not the organization itself. |
Yes, of course. That rings a bell. |
Reconsidering principal merger
Instead, let's examine the overlaps and consider alternate solutions. UsernamesSince usernames need to be unique across tables, perhaps they can be moved out into a separate model, say Pros:
Cons:
AgencyOnly the OwnershipIn contrast, any of these three models can own resources (the original idea behind this ticket, although #186 conflicts by recommending removal of ownership from organizations). Ownership can be disambiguated from agency and other model-specific data by creating a new model named Any model that needs to define ownership across entities can refer to the |
Client apps should also be considered principals as they can own data, have access rights, and have security credentials in Lastuser. The Wikipedia page for principal (computer security) explains why:
|
Since agency is not a property of all types of principals, the term 'actor' may be used to refer to only those principals that have agency. A client app using an access token on behalf of a user is not an actor. The represented user is the actor. The client app may be described as an 'agent' here. Similarly, in #153, one user may access the account of another user. In this case, the first user becomes an 'agent' while the second user is the 'actor'. However, when a client app is accessing its own resources, it is the 'actor' itself, and there is no 'agent'. |
Deprecated in favour of #232. We've successfully separated agency and ownership and incorporated some design changes into Coaster, with actual implementation in other apps to follow. This ticket can now be retired in favour of apps doing their own management. |
The User, Organization and Team models serve well-defined but overlapping needs that has led to some database kludge:
jobs@
orinfo@
). UserEmail is currently hard-linked to User. If we have to introduce a new model, we'll also need to duplicate UserEmailClaim and update all the views that refer to these models.Since this kludge is only going to grow, I propose merging the User, Organization and Team models into a unified Principal model, with one new column identifying what sort of principal it is. SQLAlchemy's single table inheritance feature will automatically assign the same table to separate User, Organization and Team classes.
The only apparent problems with this approach:
The text was updated successfully, but these errors were encountered: