Hello guys I having been keeping searching for answers for a few days and read couple of posts already but still quite confused.
I am using a user table with fields including First Name, Last Name, Email, Password, RoleID and other stuff like phone numbers etc.
Also I have a "role table" which has a Field standing for "Role Name" in string and few other fields stands for different Accesses of Boolean type such as "AccessToAlterItemInformation" which if a user with such roles who having (AccessToAlterItemInformation == True) will be granted with access to Item Editing page. There are a few questions I want to ask about this topic:
- codes like:
[Authorize(Roles="admin")]
were used to authorizing on several posts I saw but I want to do something more like
[Authorize(user.role.AccessToAlterItemInformation == true)] //I know this is not right but something similar
OR:
if (User.Roles.AccessToAlterItemInformation == True)
{
//Do something as Access granted
}
How could I achieve this? (or some other approaches which at least achieve something similar to that so I can make a website Authorizing according to different accesses)
-2. with the requirements as first question described above, I have to implement the member/user system with a MVC 4 Web Application with Razor using already created User Table and Role Table. How could I achieve that? I want to use as much as possible of whatever is already there (asp.net, simplemembership etc.) and make as little changes as possible because I really only have little time left for this project. Please help me! Thanks in advance!
And sorry for my poor English