예제 #1
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            string permissionCode = output.Attributes.Where(a => a.Name == "code").FirstOrDefault()?.Value.ToString() ?? null;

            output.TagName = "";

            if (string.IsNullOrEmpty(permissionCode))
            {
                return;
            }

            bool hasPermission = PermissionCheckHelper.HasPermission(this._httpContext, new List <string>()
            {
                permissionCode
            });

            if (hasPermission)
            {
                return;
            }

            //没权限则不输出相应的element
            output.Content.Clear();
        }
예제 #2
0
 protected override bool HasExecutePermission(AuthorizationFilterContext filterContext, List <string> permissionCodes)
 {
     return(PermissionCheckHelper.HasPermission(filterContext.HttpContext, permissionCodes));
 }