views:

133

answers:

1

What i currently have is the following:

namespace AzureCCCMVC.Controllers
{
  [Authorize(Roles="Admin")]
  public class AdminController : Controller
  {
     //Stuff
  }
}

what I want to do is have roles for each client such as

   Roles  { "DEMOAdmin", "GOOGAdmin" , "MSFTAdmin" }

and be able to Authorize The Client name (from URL) and in that role

I know I am doing a horrible job of explaining this... It is possible that I can have users that are users of several clients but only admin's of one ...

A: 

I am not sure if i understand exactly what you try to achive, but i guess you are heading in wrong direction. What would prevent you from just having roles independend from the client and store to which client an admin belongs to:

admin1 -> GOOG admin2 -> MSFT

With this information just use [Authorize(Roles="Admin")] and show the user only data that belongs to his organisation:

    [Authorize(Roles="Admin")] 
  public class AdminController : Controller 
  { 
     var data = GetDataForDomain(); //retreive data based on organisation of the user
  } 
chbu