I have a web application that holds data for multiple companies (like Multitenancy) but a user can have access to more than one company (point of difference from Multitenancy). Furthermore, a user may have different access rights for different companies.
For Example: User A has Admin access for Company A and only Basic access for Company B
To support this functionality I have added Company to the AspNetUserRoles
table. What I want to do is filter the roles returned by Identity framework based on the Company selected for the user logging in.
The application uses FindByNameAsync
method from the UserManager
class to return the user object but I assume my tie in point is further back in the stack.
What is the best way to achieve this functionality and where is the best tie in point?
Any help would be appreciated.
You can achieve this functionality by:
To get all the companies for the user:
}