惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Commits to openclaw:main
Recent Commits to openclaw:main
P
Palo Alto Networks Blog
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
Cyberwarzone
Cyberwarzone
S
Schneier on Security
T
Threatpost
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Scott Helme
Scott Helme
T
Tor Project blog
P
Privacy & Cybersecurity Law Blog
V
Vulnerabilities – Threatpost
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
Know Your Adversary
Know Your Adversary
The Hacker News
The Hacker News
Security Latest
Security Latest
A
Arctic Wolf
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
WordPress大学
WordPress大学
美团技术团队
C
Cyber Attacks, Cyber Crime and Cyber Security
罗磊的独立博客
Microsoft Security Blog
Microsoft Security Blog
量子位
H
Help Net Security
Webroot Blog
Webroot Blog
月光博客
月光博客
S
SegmentFault 最新的问题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Schneier on Security
Schneier on Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
IT之家
IT之家
H
Hacker News: Front Page
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Jina AI
Jina AI
云风的 BLOG
云风的 BLOG
J
Java Code Geeks
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Last Week in AI
Last Week in AI
C
CXSECURITY Database RSS Feed - CXSecurity.com
Spread Privacy
Spread Privacy
S
Security @ Cisco Blogs
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
D
Darknet – Hacking Tools, Hacker News & Cyber Security

博客园 - wucf2004

教你一招 - Misc类型插件的妙用(附带插件源码) 如何在nopcommerce3.3注册页面添加密码强度检查仪? nopcommerce3.3简洁版 nopcommerce里面的@Html.Widget("home_page_top") 是什么? 教你一招 - 如何给nopcommerce增加一个类似admin的area 教你一招 - 如何给nopcommerce做一套自己的主题 nopcommerce之移动版简介 网银在线插件 For Nopcommerce V2.6 支付宝插件 For Nopcommerce V2.6 教你一招 - 如何给nopcommerce增加新闻类别模块 教你一招 - 如何使用中文包 教你一招 - 如何使用nopcommerce主题(v2.5) 教你一招 - 如何安装nopcommerce2.5 PropertyInfo 又一个不错的sql分页存储过程,支持排序、搜索 PageLoad 事件执行两次 js点击显示全部内容(用于内容比较长时) - wucf2004 - 博客园 asp.net解决中文乱码问题 - wucf2004 - 博客园 asp.net根据生日计算年龄(具体到年月天)
nopcommerce之权限模块
wucf2004 · 2014-06-16 · via 博客园 - wucf2004

这篇文章简单介绍一下nopcommerce的权限模块,nopcommerce里面的权限设计相对比较简单,主要针对后台的action和前台的是否显示(比如产品、品牌等),虽然简单但是应付一般的项目应该没问题。

你只需要关注三张表:

1、AclRecord(访问控制表,比如控制某个产品某种角色前台是否可见)

2、PermissionRecord(权限表)

3、PermissionRecord_Role_Mapping(权限角色关联表)

AclRecord:

后台添加编辑产品或者品牌的时候你一定会看到有个标签叫做访问控制,如下图所示:

如果启用了并且选了对应的角色,那么保存的时候就会往这张表里面添加记录,其中EntityName是几个固定的,比如Product等,当然你也可以扩展,读取的时候就会关联到这张表进行查询,如图所示:

PermissionRecord和PermissionRecord_Role_Mapping是针对当前用户所属角色的,这部分主要用于后台,如果你看了代码你会发现后台controller里面每个action里面几乎都有类似代码,没有权限的话会返回空值或者跳转到没有权限的提示页面,如图所示:

那么如何添加自己的权限呢,首先找到Nop.Services\Security\StandardPermissionProvider.cs,参考上面的添加一条记录,别忘了GetPermissions()也要添加,还有数据库里面的表PermissionRecord添加记录,最后一步,在后台访问控制页面给每个角色设置权限。

分享是一种美。版权所有,转载请注明出处 http://www.nopchina.net/