Hi all,
I am writing an ASP.NET application that is heavily influenced by users and 
roles.  I am finding my code becoming increasing cluttered with the following 
type of thing:
IList<BusinessFunction> businessFunctions;
if (CurrentUser.RoleIsAbove(Role.BusinessUnitAdmin))
{
    if (CurrentUser.IsSystemAdmin)
        businessFunctions = CommonService.GetAll<BusinessFunction>("Deleted");
    else
        businessFunctions = CommonService.GetAll<BusinessFunction>("Deleted", 
false);                     
}
The things I am unhappy about seeing is, CurrentUser.RoleIsAbove etc.  
It is making the code messy.
I would like a way of somehow abstracting this security outside of the 
method.Can anyone think how I could raise the abstraction level somehow.
I could use custom attributes perhaps but I have 2 if staements checking user 
roles.
Can this be tidied up?
Cheers
[EMAIL PROTECTED]
_________________________________________________________________
Celeb spotting – Play CelebMashup and win cool prizes
https://www.celebmashup.com
===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to