public ActionPermissionAttribute(ActionRolePermission actionRolePermission, bool isApi = false)
            : base(typeof(ActionPermissionFilter))
        {
            Array      array = Enum.GetValues(actionRolePermission.GetType());
            List <int> roles = new List <int>();

            foreach (ActionRolePermission item in array)
            {
                roles.Add((int)item);
            }
            Arguments = new object[] { new ActionPermissionRequirement()
                                       {
                                           RoleIds = roles.ToArray(), IsApi = isApi
                                       } };
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 限定角色访问
 /// </summary>
 /// <param name="roles"></param>
 public ApiActionPermissionAttribute(ActionRolePermission actionRolePermission)
     : base(actionRolePermission, true)
 {
 }