使用多角色来控制授权,MembershipExtensions中还有部分未能完全处理
大石头 authored at 2018-03-19 18:52:53
6.81 KiB
X
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本:4.0.30319.42000
//
//     对此文件的更改可能会导致不正确的行为,并且如果
//     重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace ASP
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Web;
    using System.Web.Helpers;
    using System.Web.Mvc;
    using System.Web.Mvc.Ajax;
    using System.Web.Mvc.Html;
    using System.Web.Routing;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.WebPages;
    using NewLife;
    using NewLife.Cube;
    
    #line 1 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
    using NewLife.Model;
    
    #line default
    #line hidden
    using NewLife.Reflection;
    using NewLife.Web;
    using XCode;
    using XCode.Membership;
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Admin/Views/Index/_Left.cshtml")]
    public partial class _Areas_Admin_Views_Index__Left_cshtml : System.Web.Mvc.WebViewPage<dynamic>
    {
        public _Areas_Admin_Views_Index__Left_cshtml()
        {
        }
        public override void Execute()
        {
            
            #line 2 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
  
    var user = ViewBag.User as IUser ?? User.Identity as IUser;

    var fact = ObjectContainer.Current.Resolve<IMenuFactory>();

    var Menus = fact.Root.Childs;
    if (user != null && user.Role != null)
    {
        Menus = fact.GetMySubMenus(fact.Root.ID, user);
    }

    // 如果顶级只有一层,并且至少有三级目录,则提升一级
    if (Menus.Count == 1 && Menus[0].Childs.All(m => m.Childs.Count > 0)) { Menus = Menus[0].Childs; }

    String[] icos = new String[] { "fa-tachometer", "fa-desktop", "fa-list", "fa-pencil-square-o", "fa-list-alt", "fa-calendar", "fa-picture-o", "fa-tag", "fa-file-o" };
    Int32 _idx = 0;

            
            #line default
            #line hidden
WriteLiteral("\r\n<ul");

WriteLiteral(" class=\"nav nav-list\"");

WriteLiteral(">\r\n");

            
            #line 20 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
    
            
            #line default
            #line hidden
            
            #line 20 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
     foreach (IMenu menu in Menus.Where(m => m.Visible))
    {
        var childs = fact.GetMySubMenus(menu.ID, user).Where(m => m.Visible);
        if (_idx >= icos.Length) { _idx = 0; }

            
            #line default
            #line hidden
WriteLiteral("        <li ");

            
            #line 24 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
       Write(Html.Raw(menu == Menus[0] ? "class=\"active open\"" : ""));

            
            #line default
            #line hidden
WriteLiteral(">\r\n            <a");

WriteLiteral(" href=\"#\"");

WriteLiteral(" class=\"dropdown-toggle\"");

WriteLiteral(">\r\n                <i");

WriteAttribute("class", Tuple.Create(" class=\"", 1007), Tuple.Create("\"", 1041)
, Tuple.Create(Tuple.Create("", 1015), Tuple.Create("menu-icon", 1015), true)
, Tuple.Create(Tuple.Create(" ", 1024), Tuple.Create("fa", 1025), true)
            
            #line 26 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
, Tuple.Create(Tuple.Create(" ", 1027), Tuple.Create<System.Object, System.Int32>(icos[_idx++]
            
            #line default
            #line hidden
, 1028), false)
);

WriteLiteral("></i>\r\n                <span");

WriteLiteral(" class=\"menu-text\"");

WriteLiteral(">");

            
            #line 27 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
                                   Write(menu.DisplayName);

            
            #line default
            #line hidden
WriteLiteral("</span>\r\n\r\n                <b");

WriteLiteral(" class=\"arrow fa fa-angle-down\"");

WriteLiteral("></b>\r\n            </a>\r\n");

            
            #line 31 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
            
            
            #line default
            #line hidden
            
            #line 31 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
             if (childs.Any())
            {

            
            #line default
            #line hidden
WriteLiteral("                <b");

WriteLiteral(" class=\"arrow\"");

WriteLiteral("></b>\r\n");

            
            #line 34 "..\..\Areas\Admin\Views\Index\_Left.cshtml"


            
            #line default
            #line hidden
WriteLiteral("                <ul ");

            
            #line 35 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
               Write(Html.Raw(menu == Menus[0] ? "class=\"submenu nav-show\" style=\"display:block;\"" : "class=\"submenu nav-hide\" style=\"display:none;\""));

            
            #line default
            #line hidden
WriteLiteral(">\r\n");

            
            #line 36 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
                    
            
            #line default
            #line hidden
            
            #line 36 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
                     foreach (IMenu menu2 in childs)
                    {
                        
            
            #line default
            #line hidden
            
            #line 38 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
                   Write(Html.Partial("_Left_Item", menu2));

            
            #line default
            #line hidden
            
            #line 38 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
                                                          ;
                    }

            
            #line default
            #line hidden
WriteLiteral("                </ul>\r\n");

            
            #line 41 "..\..\Areas\Admin\Views\Index\_Left.cshtml"

                
            
            #line default
            #line hidden
            
            #line 47 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
                           
            }

            
            #line default
            #line hidden
WriteLiteral("        </li>\r\n");

            
            #line 50 "..\..\Areas\Admin\Views\Index\_Left.cshtml"
    }

            
            #line default
            #line hidden
WriteLiteral("</ul>\r\n<!-- /.nav-list -->");

        }
    }
}
#pragma warning restore 1591