定义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 ))
时间: 2024-11-10 12:08:21