Last post Feb 20, 2020 03:12 PM by bruce (sqlwork.com)
Feb 20, 2020 05:42 AM|salad000|LINK
Let’s say I have 3 individual applications each having its own application name, I want an admin to be able to register users to one or more of those application(s). One user can be given access to more than 1 applications if needed.
Admin page: Admin who manage/ register users
Application_B: User1, User2
I wanted to implement this because currently I have admin that can assign group of roles for the user, but each application is developed by other programmers and using the [Authorize] attribute, and there is an issue when the Authorized role name used in
other application are same like viewReport role both occurred in Application_A and Application_B, it might cause unauthorized user to access the other application’s viewReport function.
I've made a checkbox that get the application name from my asp_Applications table, is it possible that when the selected checkbox contains the application name, the user is registered to that application’s membership upon my
I've been thinking if i should include all the applications membership providers in the web.config and find a way that take my selected check box as parameter to add the user into particular application's membership but I am lost here, can anyone guide me
on how to do it? Am i using wrong approach?
I've saw people talking about customize role provider or change the attribute so that it does not conflict with other applications, but I wish not to touch the roles of all the applications if possible.
Feb 20, 2020 03:12 PM|bruce (sqlwork.com)|LINK
Most likely the user roles must also vary by application. So you need a join table of userid, applicationid and role.
then you just write a custom role provider that loads roles based on applicationid and user name. See the docs for your version of mvc & identity to do a custom role provider. It’s just a simple interface.