Exemplo n.º 1
0
 /// <summary>
 /// 根据授权类型、名称、ID和排序位创建一个菜单标记。
 /// </summary>
 /// <param name="authType">授权类型</param>
 /// <param name="name">菜单名称</param>
 /// <param name="id">菜单ID</param>
 /// <param name="ord">排序位</param>
 public JAuthAttribute(JAuthType authType, string name = "", string id = "", int ord = 0)
 {
     AuthType = authType;
     Name     = name;
     Id       = id;
     Ord      = ord;
 }
        JAuthAttribute GetMenu(Type controllerType, JAuthType defaultAuthType, JLogType defaultLogType)
        {
            string controllerName = controllerType.Name.Substring(0, controllerType.Name.Length - 10);
            var    attr           = controllerType.GetCustomAttributes(false)
                                    .FirstOrDefault(co => co is JAuthAttribute) as JAuthAttribute;

            if (attr == null)
            {
                attr         = new JAuthAttribute(defaultAuthType, controllerName);
                attr.LogType = defaultLogType;
            }
            if (attr.Name.IsEmpty())
            {
                attr.Name = controllerName;
            }

            if (controllerType.Assembly == this.GetType().Assembly)
            {
                attr.AreaName = "/AppCenter";
            }
            return(attr);
        }
Exemplo n.º 3
0
 public JAuthAttribute(JAuthType authType, VisibleType visible)
 {
     AuthType = authType;
     Visible  = visible;
 }
Exemplo n.º 4
0
 /// <summary>
 /// 根据授权类型创建一个权限标签
 /// </summary>
 /// <param name="authType">授权类型</param>
 public JAuthAttribute(JAuthType authType)
 {
     AuthType = authType;
 }