示例#1
0
        public AllowRole AddRole(string roleName)
        {
            var allow = new AllowRole(roleName);

            _policies.AddValue(allow);

            return allow;
        }
示例#2
0
        /// <summary>
        /// Adds an authorization rule based on membership in a given role
        /// on the principal
        /// </summary>
        /// <param name="roleName"></param>
        /// <returns></returns>
        public AllowRole AddRole(string roleName)
        {
            if (AllowedRoles().Contains(roleName))
            {
                return(null);
            }

            var allow = new AllowRole(roleName);

            _policies.Add(allow);

            return(allow);
        }