Is it somehow possible to get asp.net identity to require membership of 2 roles before granting access?
I have 2 layers of rights in my system. First a company type that grants access to certain features, and secondly one that restricts the specific method and usage rights.
CompanyType= Host,Expert,Manufacturer,Supplier,Consultant
Accesslevel= Admin,ReadOnly,ReadWrite
i want to be able to do something like this:
[Authorize(Roles = "Expert && ReadWrite || ReadOnly")]
The goal is to have one way of handling both instead of having these roles:
HostAdmin, HostReadOnly, HostReadWrite, ExpertAdmin ....
Thanks for your time.
Yes you can require more than one role, you just add more authorize attributes:
[Authorize(Roles="members")]
[Authorize(Roles="admin")]
This will require the user to both have the members and admin role
For more details -> Allow multiple roles to access controller action
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With