I added the AuthorizeAttribute to secure my ActionResult.
[Authorize(Roles = "MyUser, Admin")]
public ActionResult Index()
{
var allData = myDataRepository.FindAllData();
return View(allData);
}
The Index view displays a list of data from my table. I want to show 1 row is the user Role is MyUser and all rows if the Role is Admin.
Is the correct (MVC) way just checking for the user Role and doing an if else?