Exemple #1
0
        public static IEnumerable <AuthorizationBehavior> GetAuthorizationBehaviors(object target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            List <AuthorizationBehavior> binders = new List <AuthorizationBehavior>();

            foreach (AuthorizationRule rule in AuthorizationRuleManager.GetAuthorizationRules(target))
            {
                binders.AddRange(rule.GetAuthorizationBehaviors(target));
            }

            return(binders);
        }
Exemple #2
0
        public static IEnumerable <AuthorizationAttribute> GetAuthorizationAttributes(object target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            List <AuthorizationAttribute> attributes = new List <AuthorizationAttribute>();

            foreach (AuthorizationRule rule in AuthorizationRuleManager.GetAuthorizationRules(target))
            {
                attributes.AddRange(rule.GetAuthorizationAttributes(target));
            }

            return(attributes);
        }