Project Description
ASP.Net Permission Manager is an extension of ASP.Net Role Manager that allow to affect permissions to roles.

I will not explain ASP.Net Role Manager, you will find all informations on Microsoft web site :
http://msdn.microsoft.com/en-us/library/ms998314.aspx

There are some issues (or limitations) in ASP.Net Role Manager.
Take the following example :
Our application have 3 fonctionnalities (F1, F2 and F3).
We create 2 roles (R1 and R2).
R1 give access to F1
R2 give access to F2 and F3

We have this code :
if(Principal.IsInRole("R1"))
{
    //F1
}
if(Principal.IsInRole("R2"))
{
    //F2
    //F3
}


Now the needs changes and we have to create another role (R3) that give access to F1 and F3.
We have to change our code :
if(Principal.IsInRole("R1"))
{
    //F1
}
if(Principal.IsInRole("R2"))
{
    //F2
    //F3
}
if(Principal.IsInRole("R3"))
{
    //F1
    //F3
}


Now the needs changes again, R1 must give access to F1 and F2.
We have to change our code again.
if(Principal.IsInRole("R1"))
{
    //F1
    //F2
}
if(Principal.IsInRole("R2"))
{
    //F2
    //F3
}
if(Principal.IsInRole("R3"))
{
    //F1
    //F3
}


Everytime the access right change we have to change our code. It must be difficult in a big application.

With ASP.Net Permission Manager, there are one permission per fonctionalities and you never use roles in code.
So you can change roles without change your code.

In our example, our code will be :
if(Permissions.UserHasPermission("F1"))
{
    //F1
}
if(Permissions.UserHasPermission("F2"))
{
    //F2
}
if(Permissions.UserHasPermission("F3"))
{
    //F3
}


See also :
http://www.michaelalbaladejo.com/post/2010/04/06/ASP-Net-Permission-Management-Part-1.aspx
http://www.michaelalbaladejo.com/post/2010/04/06/ASP-Net-Permission-Management-Part-2.aspx

My others projects :
http://permissionmanager.codeplex.com
http://asproutingconfig.codeplex.com
http://silverlightmef.codeplex.com

Last edited Jun 9, 2010 at 5:46 AM by malbaladejo, version 16