Example #1
0
 private string AuthenticationButton(QuerySet querySet)
 {
     if (RegisterAuthority)
     {
         FapMenuButton menuButton = new FapMenuButton()
         {
             ButtonID    = Id,
             ButtonName  = "表格按钮",
             ButtonType  = FapMenuButtonType.Grid,
             Description = _dbContext.Table(querySet.TableName).TableComment
         };
         //注册按钮
         return(_rbacService.GetMenuButtonAuthority(_applicationContext.CurrentRoleUid, menuButton));
     }
     return(string.Empty);
 }
 private string GetButtonPermission()
 {
     if (RegisterButton)
     {
         FapMenuButton menuButton = new FapMenuButton()
         {
             ButtonID    = Id,
             ButtonName  = "树按钮",
             ButtonType  = FapMenuButtonType.Tree,
             Description = Description,
             Enabled     = 1
         };
         //注册按钮
         return(_rbacService.GetMenuButtonAuthority(_applicationContext.CurrentRoleUid, menuButton));
     }
     return(string.Empty);
 }
Example #3
0
        public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            var button = new Core.Rbac.Model.FapMenuButton()
            {
                ButtonID    = Id,
                ButtonName  = Content,
                Description = Content,
                Enabled     = 1,
                ButtonType  = BtnTag == ButtonTag.link?FapMenuButtonType.Link:FapMenuButtonType.Button
            };
            //注册按钮,同时获取多语名称
            string permission = _rbacService.GetMenuButtonAuthority(_applicationContext.CurrentRoleUid, button);

            if (permission.IsPresent() && permission.Equals("1"))
            {
                StringBuilder builder = new StringBuilder();
                if (BtnTag == ButtonTag.link)
                {
                    button.ButtonType = FapMenuButtonType.Link;
                    output.TagName    = "a";
                    output.Attributes.Add("class", ClassName);
                    output.Attributes.Add("id", Id);
                    output.Attributes.Add("href", LinkHref.IsMissing() ? "javascript:void(0)" : LinkHref);
                    output.Attributes.Add("title", button.Description);
                    builder.Append($"  <i class=\"ace-icon {IconBefore}\"></i>");
                    builder.Append(button.Description);
                }
                else
                {
                    button.ButtonType = FapMenuButtonType.Button;
                    output.TagName    = "button";
                    output.Attributes.Add("class", ClassName);
                    //builder.Append($" <button {Attribute} class=\"btn {ClassName}\">");
                    builder.Append($"<i class=\"ace-icon {IconBefore}\"></i>");
                    builder.Append(button.Description);
                    builder.Append($" <span class=\"ace-icon {IconAfter} icon-on-right\"></span>");
                    //builder.Append("</button>");
                }


                output.Content.SetHtmlContent(builder.ToString());
            }
            return(base.ProcessAsync(context, output));
        }
Example #4
0
        private string AuthenticationButton(QuerySet querySet)
        {
            string btnId = Id;

            if (IsSubgrid)
            {
                btnId = Id.Substring(0, Id.LastIndexOf("_"));
            }
            FapMenuButton menuButton = new FapMenuButton()
            {
                ButtonID    = btnId,
                ButtonName  = "表格按钮",
                Enabled     = 1,
                ButtonType  = FapMenuButtonType.Grid,
                Description = _dbContext.Table(querySet.TableName).TableComment
            };

            //注册按钮
            return(_rbacService.GetMenuButtonAuthority(_applicationContext.CurrentRoleUid, menuButton));
        }