码迷,mamicode.com
首页 > Web开发 > 详细

ASP.NET ZERO 学习一,导航菜单

时间:2016-07-31 11:21:05      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:

定义PageNames和PermissionName

PageNames : Web/App_Start/Navigation/PageNames.cs

 public const string Dashboard = "Dashboard.Tenant";

PermissionName:Core/Authorization/AppPermissions.cs

 public const string Pages_Tenant_Dashboard = "Pages.Tenant.Dashboard";//工作台

设置权限: Core/Authorization/AppAuthorizationProvider.cs

public override void SetPermissions(IPermissionDefinitionContext context)
{
    //COMMON PERMISSIONS (FOR BOTH OF TENANTS AND HOST)

    var pages = context.GetPermissionOrNull(AppPermissions.Pages) ?? context.CreatePermission(AppPermissions.Pages, L("Pages"));

    //TENANT-SPECIFIC PERMISSIONS

    pages.CreateChildPermission(AppPermissions.Pages_Tenant_Dashboard, L("Dashboard"), multiTenancySides: MultiTenancySides.Tenant);
   
}

 

菜单定义:Web/App/Startup/AppNavigationProvider.cs

示例:

.AddItem(new MenuItemDefinition(
                    PageNames.App.Tenant.Dashboard,
                    L("Dashboard"),
                    url: "tenant.dashboard",
                    icon: "icon-home",
                    requiredPermissionName:  AppPermissions.Pages_Tenant_Dashboard
                    ))

技术分享

 

ASP.NET ZERO 学习一,导航菜单

标签:

原文地址:http://www.cnblogs.com/fanxingthink/p/5722506.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!