While looking into forms authorizing/authentication, I found that it is possible to do role based authorizing by adding an array of roles to a FormsAuthenticationTicket. That way I can write
User.IsInRole(role from database)
But is there any way to do the same thing with permissions on a role like :
if (User.IsInRole(role from database)) {
if (User.CanRead()) {
//--- Let the user read
}
if (User.CanWrite()) {
//--- Let the user write
}
}
I have read a couple of articles and forum post s where permission is added to the array instead of the roles, resulting in using
User.IsInRole(permission from database)
However that s not the same thing. Hope someone can give some input on this matter, throw a link to an article or better yet, an code sample.