Simple multi role mvc example

I’m trying to find out the easiest way to create a set of users that have a few different roles.

I’m a c# ASP.Net MVC core developer using Auth0. I used this QuickStart is what I used to get me going

I’ve got my Web App running with Auth0 such that I can check

  1. if the user has been authenticated and
  2. if they have been verified.

Currently It can also detect which user has the admin role (or just a user role). I did this by creating a rule based on roles-creation.

I can determine who gets access to my admin view by adding this to my controller like so…

  [Authorize(Roles = "admin")]  
  public async Task<IActionResult> Admin()
   return View();

Based on the rule I've created, it's either **admin** or **user**, and I need to have multiple roles for specific users.  What's the best/easiest way to do that?

###To many options
1. should I use  Auth0 Authorization extension
2. should I tweek the current rule I'm using so that a set of users can be assigned 1 or more roles
3. should I go to each individual user and modify the json for the **user_metadata**
4. should I go to each individual user and modify the json for the **app_metadata**

### Tweaks
I tweaked around trying various things, but I just don't know enough to figure out what to do.

I thought I would try this forum.  Any help would be appreciated.

Hey there @JohnMarsing, I apologize for the delay in response.

After confirming with one of our senior engineers, Role Based Access Control (RBAC ) would be the best bet towards a quick and easy implementation of this. Please take a look and let me know if you have any questions!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.