nop4.3 admin中添加新菜单
感觉跟之前版本区别不是很大,先记录下。
1. 首先在sitemap.config 文件里添加菜单。
<siteMapNode SystemName="SystemManage" nopResource="系统管理" PermissionNames="per_sys_role,per_sys_permission,per_sys_user" IconClass="fa-line-chart">
<siteMapNode SystemName="sys_role" nopResource="角色管理" PermissionNames="per_sys_role" controller="SystemManage" action="Role" IconClass="fa-dot-circle-o"/>
<siteMapNode SystemName="sys_permission" nopResource="权限管理" PermissionNames="per_sys_permission" controller="SystemManage" action="Permission" IconClass="fa-dot-circle-o"/>
<siteMapNode SystemName="sys_user" nopResource="用户管理" PermissionNames="per_sys_user" controller="SystemManage" action="User" IconClass="fa-dot-circle-o"/>
</siteMapNode>
2. 然后在数据库PermissionRecord表里添加该菜单。

3. 还需要在 Nop.Services.Security.StandardPermissionProvider.cs 文件里添加权限记录
public static readonly PermissionRecord per_sys_role = new PermissionRecord { Name = "Admin area. Manage system", SystemName = "per_sys_role", Category = "SystemManage" };
public static readonly PermissionRecord per_sys_permission = new PermissionRecord { Name = "Admin area. Manage system", SystemName = "per_sys_permission", Category = "SystemManage" };
public static readonly PermissionRecord per_sys_user = new PermissionRecord { Name = "Admin area. Manage system", SystemName = "per_sys_user", Category = "SystemManage" };
public virtual IEnumerable<PermissionRecord> GetPermissions()
{
return new[]
{
AccessAdminPanel,
AllowCustomerImpersonation,
ManageProducts,
ManageCategories,
ManageManufacturers,
ManageProductReviews,
ManageProductTags,
ManageAttributes,
ManageCustomers,
ManageVendors,
ManageCurrentCarts,
ManageOrders,
ManageRecurringPayments,
ManageGiftCards,
ManageReturnRequests,
OrderCountryReport,
ManageAffiliates,
ManageCampaigns,
ManageDiscounts,
ManageNewsletterSubscribers,
ManagePolls,
ManageNews,
ManageBlog,
ManageWidgets,
ManageTopics,
ManageForums,
ManageMessageTemplates,
ManageCountries,
ManageLanguages,
ManageSettings,
ManagePaymentMethods,
ManageExternalAuthenticationMethods,
ManageTaxSettings,
ManageShippingSettings,
ManageCurrencies,
ManageActivityLog,
ManageAcl,
ManageEmailAccounts,
ManageStores,
ManagePlugins,
ManageSystemLog,
ManageMessageQueue,
ManageMaintenance,
HtmlEditorManagePictures,
ManageScheduleTasks,
DisplayPrices,
EnableShoppingCart,
EnableWishlist,
PublicStoreAllowNavigation,
AccessClosedStore,
per_sys_role,
per_sys_permission,
per_sys_user
};
}
/// <summary>
/// Get default permissions
/// </summary>
/// <returns>Permissions</returns>
public virtual HashSet<(string systemRoleName, PermissionRecord[] permissions)> GetDefaultPermissions()
{
return new HashSet<(string, PermissionRecord[])>
{
(
NopCustomerDefaults.AdministratorsRoleName,
new[]
{
AccessAdminPanel,
AllowCustomerImpersonation,
ManageProducts,
ManageCategories,
ManageManufacturers,
ManageProductReviews,
ManageProductTags,
ManageAttributes,
ManageCustomers,
ManageVendors,
ManageCurrentCarts,
ManageOrders,
ManageRecurringPayments,
ManageGiftCards,
ManageReturnRequests,
OrderCountryReport,
ManageAffiliates,
ManageCampaigns,
ManageDiscounts,
ManageNewsletterSubscribers,
ManagePolls,
ManageNews,
ManageBlog,
ManageWidgets,
ManageTopics,
ManageForums,
ManageMessageTemplates,
ManageCountries,
ManageLanguages,
ManageSettings,
ManagePaymentMethods,
ManageExternalAuthenticationMethods,
ManageTaxSettings,
ManageShippingSettings,
ManageCurrencies,
ManageActivityLog,
ManageAcl,
ManageEmailAccounts,
ManageStores,
ManagePlugins,
ManageSystemLog,
ManageMessageQueue,
ManageMaintenance,
HtmlEditorManagePictures,
ManageScheduleTasks,
DisplayPrices,
EnableShoppingCart,
EnableWishlist,
PublicStoreAllowNavigation,
AccessClosedStore,
per_sys_role,
per_sys_permission,
per_sys_user
}
),
(
NopCustomerDefaults.ForumModeratorsRoleName,
new[]
{
DisplayPrices,
EnableShoppingCart,
EnableWishlist,
PublicStoreAllowNavigation
}
),
(
NopCustomerDefaults.GuestsRoleName,
new[]
{
DisplayPrices,
EnableShoppingCart,
EnableWishlist,
PublicStoreAllowNavigation
}
),
(
NopCustomerDefaults.RegisteredRoleName,
new[]
{
DisplayPrices,
EnableShoppingCart,
EnableWishlist,
PublicStoreAllowNavigation
}
),
(
NopCustomerDefaults.VendorsRoleName,
new[]
{
AccessAdminPanel,
ManageProducts,
ManageProductReviews,
ManageOrders
}
)
};
}
4. 配置角色和权限记录表的关系,可在admin界面里操作。


nop4.3 admin中添加新菜单的更多相关文章
- 在ECSHOP后台左侧导航中增加新菜单
在ECSHOP后台左侧导航中增加新菜单 ECSHOP教程/ ecshop教程网(www.ecshop119.com) 2011-11-08 有个别高级用户(懂PHP的),提到这样的问题: 在后台管 ...
- 在ubuntu中添加新硬盘
在ubuntu中添加新硬盘 转载于 http://www.cnblogs.com/unipower/archive/2009/03/08/1406230.html 前言 安装新硬盘这种事情并不会经常 ...
- 仅在TabControl中的Tab中添加右键菜单
若想实现仅在TabControl中的Tab中添加右键菜单,可在XAML中通过使用样式得到: <TabControl> <TabControl.ItemContainerStyle&g ...
- 向CDH5集群中添加新的主机节点
向CDH5集群中添加新的主机节点 步骤一:首先得在新的主机环境中安装JDK,关闭防火墙.修改selinux.NTP时钟与主机同步.修改hosts.与主机配置ssh免密码登录.保证安装好了perl和py ...
- (原)torch7中添加新的层
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/6069627.html 参考网址: http://torch.ch/docs/developer-doc ...
- gitignore文件中添加新过滤文件,但是此文件已经提交,如何解决?
gitignore文件中添加新过滤文件,但是此文件已经提交到远程库,如何解决? 第一步,为避免冲突需要先同步下远程仓库 git pull 第二步,在本地项目目录下删除缓存 git rm -r --ca ...
- C# 往Datatable中添加新行的步骤
以一个实例说明 //录入年份绑定 public void YearList(FineUIPro.DropDownList ddlYear) { //年份从15年到当前年//起止年份 ; int yea ...
- SqlServer表中添加新字段
表中添加新字段ALTER TABLE 表名 ADD 字段名 VARCHAR(20) NULL 表中添加自增idalter table lianxi add id int primary key IDE ...
- Spring中添加新的配置表,并对新的配置表进行处理
实习过程中boss交代的任务(以下出现的代码以及数据只给出小部分,提供一个思路) 目的:Spring中添加新的配置表,并对新的配置表进行处理:替换的新的配置表要友好,同时保证替换前后功能不能发生变化. ...
- 向SQL Server 现有表中添加新列并添加描述.
注: sql server 2005 及以上支持. 版本估计是不支持(工作环境2005,2008). 工作需要, 需要向SQL Server 现有表中添加新列并添加描述. 从而有个如下存储过程. (先 ...
随机推荐
- Shiro+SpringBoot前后端分离中跨域,sessionId,302问题
1.解决跨域 @Configuration public class CorsConfig { public CorsConfiguration buildConfig() { CorsConfigu ...
- ES6判断对象是否为空
1.ES6判断对象是否为空{} let obj = {} if(Object.keys(obj).length == 0){ console.log("对象是空的") }else{ ...
- 3.2 删除XxxControler中各方法中的response
3.2.1 EmpController代码 package com.hy.controller; import javax.servlet.http.HttpServletRequest; impor ...
- list.ftl
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 < ...
- Windows 安装 Docker 并使用 VS code 连接
安装前提 Docker是基于linux的,在win10中安装wsl2:Windows Subsystem for Linux,让win10能够原生运行Linux二进制可执行文件的兼容层,且不会产生传统 ...
- 新发现的几个不错的c++库
1.coost 包含了各种常用的库,比boost轻量级的基于c++11的库 https://github.com/idealvin/coost 2.ImGui 一个较少依赖的gui界面库 https: ...
- 查看git的用户名和密码
转载自:https://www.cnblogs.com/xihailong/p/13354628.html 一.查看查看用户名 :git config user.name查看密码: git confi ...
- centos安装Jenkins报错
[SKIPPED] jenkins-2.249.3-1.1.noarch.rpm: Already downloaded warning: /var/cache/dnf/jenkins-0919f06 ...
- 创建maven项目时,IntelliJ IDEA2019出现:Unable to import maven project: See logs for details 报错
开发环境:IntelliJ IDEA 2019.1.3 + Maven3.6.3 报错截图 主要原因 IntelliJ IDEA 2019.1.3 与 Maven3.6.3 不兼容问题 解决方案 将m ...
- linux rpm 命令
# 产看软件包信息[root@devops201 k8s_install]# rpm -qi yum-utilsName : yum-utilsVersion : 1.1.31Release : 54 ...