Beispiel #1
0
        /// <summary>
        /// Returns whether given principal has given permission
        /// </summary>
        public static bool HasPermission(this IPrincipal principal, Permission permission)
        {
            if (principal == null)
            {
                throw new ArgumentNullException("principal");
            }
            if (permission == null)
            {
                throw new ArgumentNullException("permission");
            }

            return(principal.GetRole().Has(permission));
        }