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 现有表中添加新列并添加描述. 从而有个如下存储过程. (先 ...
随机推荐
- C# 元组类型和元组文本
从 C# 7.0 开始,可以使用元组类型和元组文本轻松实现此目的. 元组类型定义元 组元素的数据类型. 元组文本提供返回的元组的实际值. 在下面的示例中, (string, string, strin ...
- windows-sam文件
sam文件是账号密码的数据库文件 存放位置C:\Windows\System32\Config\sam
- 【C学习笔记】day3-1 将数组A中的内容和数组B中的内容进行交换。(数组一样大)
#include <stdio.h> int main() { int a[5]; for (int i = 0; i < 5; i++) { scanf_s("%d&qu ...
- C - Functions again CodeForces - 789C
C - Functions again CodeForces - 789C 这道题考查了对Map的运用 #include<iostream> #include<cstdio> ...
- C# 连接SQLSERVER数据库常用操作类
//数据库连接字符串 public static string connectStr = @"server=.;database=test;uid=sa;pwd=123456;"; ...
- nacos启动报错
Caused by: com.alibaba.nacos.api.exception.NacosException: Nacos Server did not start because dumpse ...
- QML笔记
文章钢要: 1.qml基础知识 2.qml语言技巧 一.QML basic types QML Language提供的基础类型:int ,bool,string,double,real,var,url ...
- 利用for循环同步执行异步方法
//定义一个异步函数 const foo1 = (i) => { return new Promise((resolve, reject) => { setTimeout(() => ...
- pgsql中over函数的应用
-- sum() over(partition by ... order by ...)SELECT len/sum(len)over(partition by road_id) param from ...
- Selinux讲解
手动开启/关闭/查询 SELINUX状态的方法在Limx操作系统运行过程中无法使用命令停用 SELINUX,可以在内核启动参数或使用修改配置文件的方式去关闭 SELINUX安全机制.若只是要将 SEL ...