Source/NFX/Security/Permissions.cs
/// <summary>
/// Checks the action represented by MemberInfo by checking the permission-derived attributes and returns false if
/// any of authorization attributes do not pass
/// </summary>
Checks the action represented by MemberInfo by checking the permission-derived attributes and returns false if
any of authorization attributes do not pass
Checks the action represented by MemberInfo by checking the permission - derived attributes and returns false if any of authorization attributes do not pass
public static Permission FindAuthorizationFailingPermission(MemberInfo actionInfo, ISession session = null, GetSessionFunc getSessionFunc = null)
           { 
             Permission[] permissions;
             if (!s_AttrCache.TryGetValue(actionInfo, out permissions))
             {
               permissions = actionInfo.GetCustomAttributes(typeof(Permission), true).Cast<Permission>().ToArray();
               var dict = new Dictionary<MemberInfo,Permission[]>(s_AttrCache);
               dict[actionInfo] = permissions;
               s_AttrCache = dict;
             }
             for(var i=0; i<permissions.Length; i++)
             {
               var permission = permissions[i];
               if (i==0 && session==null && getSessionFunc!=null) session = getSessionFunc();
               if (!permission.Check(session)) return permission;
             }
             return null;
           }
public static Permission FindAuthorizationFailingPermission ( MemberInfo actionInfo , ISession session = null , GetSessionFunc getSessionFunc = null ) { Permission [ ] permissions ; if ( ! s_AttrCache . TryGetValue ( actionInfo , out permissions ) ) { permissions = actionInfo . GetCustomAttributes ( typeof ( Permission ) , true ) . Cast < Permission > ( ) . ToArray ( ) ; var dict = new Dictionary < MemberInfo , Permission [ ] > ( s_AttrCache ) ; dict [ actionInfo ] = permissions ; s_AttrCache = dict ; } for ( var i = 0 ; i < permissions . Length ; i ++ ) { var permission = permissions [ i ] ; if ( i == 0 && session == null && getSessionFunc != null ) session = getSessionFunc ( ) ; if ( ! permission . Check ( session ) ) return permission ; } return null ; }
Checks the action represented by MemberInfo by checking the permission-derived attributes and returns false if
any of authorization attributes do not pass
Checks the action represented by MemberInfo by checking the permission - derived attributes and returns false if any of authorization attributes do not pass
//20150124 DKh - added caching instead of reflection. Glue inproc binding speed improved 20% //atomic
actionInfo
MemberInfo
session
ISession
getSessionFunc
GetSessionFunc