search
HomeBackend DevelopmentPHP TutorialRBAC,苦思多日,角色何解?

RBAC中,角色不是很理解,比如,销售经理和济南销售经理,这2个概念很模糊

一个说的是销售经理,没有说明是那个地区的

一个很具体,说的是济南的

我想问,角色是具体的还是模糊的,因为所有区的销售经理都相同的权限,建立销售经理这个角色,就是为了统一给所有地区的销售经理授权,总不能一个地区,建立一个销售经理的角色吧

角色定位?这种情况,如何建立角色权限方案?

知乎没人回答, http://zhi.hu/7dCn

SegmentFault也没人回答, http://segmentfault.com/q/1010000000650304

求救。。。。。。。。。。。。

好多日子了,。。。。。。。。


回复讨论(解决方案)

这跟会员权限不是一样的么,这要看你怎么设计权限了
第一种:销售经理都有一样的权限,不论哪个地方
那就只需要销售经理这个权限组
第二种:销售经理都有一样的权限,但是不同地区又有不一样的权限
销售经理就好比一个基类,济南销售经理继承了销售经理,再派生出其他单独的权限
数据库的设计就好比二级导航一样,济南销售经理的上级就是销售经理

这跟会员权限不是一样的么,这要看你怎么设计权限了
第一种:销售经理都有一样的权限,不论哪个地方
那就只需要销售经理这个权限组
第二种:销售经理都有一样的权限,但是不同地区又有不一样的权限
销售经理就好比一个基类,济南销售经理继承了销售经理,再派生出其他单独的权限
数据库的设计就好比二级导航一样,济南销售经理的上级就是销售经理


。。。。

,,权限组?每个地方的销售经理,功能权限是一样的,当数据权限是不一样的

,,如果都继承了,那得建多少角色啊,加一个分区就建一个角色,。。。

谢谢你的回答,。。呵呵,其实,我想搞清楚,,角色,数据权限,功能权限,如何设计好。

毕竟,新建一个地区销售部门,那么销售经理的功能权限是一样的,就是数据权限不一样,他只对本区的人员有销售经理权限。。

其实,还有一个问题比较严重。。。


一个人管理多个部门,担任不同职务。。。权限组,应该解决不了

下面的方法可行?
部门表                                  职位表                                              管理关系表                                             人员表
id     name                           id         name          pid                   id       管理人员的id     部门id               id            name            职位id
1      销售部门                      1          销售经理     1                      1        1                           1                       1             管理员1号    2
2      管理部门                      2          管理人员      2                     2        1                           3
3      采集部门 
管理员1号根据职位id找到他是管理部门,那么就去管理关系表查找他所管理的部门,可以看出他管理的是销售部门和采集部门

卧槽,不是所见即所得么?好吧,你复制出去,对其后将就看吧

一个角色就可以了,只不过有个所属区域属性。

角色,指演员扮演的剧中人物,也比喻生活中某种类型的人物和戏曲演员专业分工的类别。
RBAC 的角色(Role)就属于专业分工的类别

某个角色,比如销售经理,就具有其特定的权限
这是抽象的

在现实中,一个角色可以由多人扮演;一个人也可扮演多个角色
这些都与程序无关,程序只认角色而不认人

角色,指演员扮演的剧中人物,也比喻生活中某种类型的人物和戏曲演员专业分工的类别。
RBAC 的角色(Role)就属于专业分工的类别

某个角色,比如销售经理,就具有其特定的权限
这是抽象的

在现实中,一个角色可以由多人扮演;一个人也可扮演多个角色
这些都与程序无关,程序只认角色而不认人



销售经理是抽象的,那济南区销售经理呢?也是抽象的?

系统中,这种类型,没法设计哦,

所有的销售经理,都是一个功能划分,就是管理的区域不通,这种是通过角色解决还是?



一个角色就可以了,只不过有个所属区域属性。



角色加个地区属性??

??那怎么设计用户角色???,,

下面的方法可行?
部门表                                  职位表                                              管理关系表                                             人员表
id     name                           id         name          pid                   id       管理人员的id     部门id               id            name            职位id
1      销售部门                      1          销售经理     1                      1        1                           1                       1             管理员1号    2
2      管理部门                      2          管理人员      2                     2        1                           3
3      采集部门 
管理员1号根据职位id找到他是管理部门,那么就去管理关系表查找他所管理的部门,可以看出他管理的是销售部门和采集部门



这个不行哦,。。

系统中只有 销售经理,并没有 济南区销售经理
所谓 济南区销售经理 只是注册在 济南区 的某个用户以 销售经理 角色出现

角色是按业务需求设定的,你需要指定某人(某些人)充当某个角色

建立角色“地区经理”,为该角色分配对应地区的动态资源访问权限。然后添加用户的时候同时给“地区经理”和"销售经理"两个角色就可以了。

角色和权限的问题。
【用例】
 系统管理员为用户A创建帐户后,为他设置了销售经理角色,并赋予其“可查看某地域数据”的权限,于是,某地域销售经理诞生了。

当然,如果各地域销售经理角色有很多共性,可以设置一个销售组,并赋于销售角色,给其共有的权限。当有其它地域的销售经理加入系统时,只需要加入销售组即可,这样,管理员配置上会更方便一些。

角色和权限的问题。
【用例】
 系统管理员为用户A创建帐户后,为他设置了销售经理角色,并赋予其“可查看某地域数据”的权限,于是,某地域销售经理诞生了。

当然,如果各地域销售经理角色有很多共性,可以设置一个销售组,并赋于销售角色,给其共有的权限。当有其它地域的销售经理加入系统时,只需要加入销售组即可,这样,管理员配置上会更方便一些。



很不多,谢谢,你那个里版主,给你看个文章,帮我看看后半部什么意思,看不懂

http://kb.cnblogs.com/page/44144/

lz,听劝,静下心好好想想,权限设计,越简单越好..

角色管理、功能管理、上下级管理的权限能分开最好。意思是即便他只是个底层的销售人员,都可以随时拥有所有功能,管理大量的组织,而不会因为他的角色而无法调整!

lz,听劝,静下心好好想想,权限设计,越简单越好..

角色管理、功能管理、上下级管理的权限能分开最好。意思是即便他只是个底层的销售人员,都可以随时拥有所有功能,管理大量的组织,而不会因为他的角色而无法调整!




哎,你说的真不错,我都有点怀疑自己是不是走火入魔了,想了好多天了,呵呵

lz,听劝,静下心好好想想,权限设计,越简单越好..

角色管理、功能管理、上下级管理的权限能分开最好。意思是即便他只是个底层的销售人员,都可以随时拥有所有功能,管理大量的组织,而不会因为他的角色而无法调整!



绝对正确!
产品投入使用后一定会有各种诡异需求,所以越简单越灵活越好

权限没你想的那么复杂
1、就数据模型来说一个递归树足够了
2、就业务来说只需要实现快速提取权限和分配树中的节点给用户即可

谢谢各位的发言,这个问题吾将深究下

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
11 Best PHP URL Shortener Scripts (Free and Premium)11 Best PHP URL Shortener Scripts (Free and Premium)Mar 03, 2025 am 10:49 AM

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Working with Flash Session Data in LaravelWorking with Flash Session Data in LaravelMar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

Build a React App With a Laravel Back End: Part 2, ReactBuild a React App With a Laravel Back End: Part 2, ReactMar 04, 2025 am 09:33 AM

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Simplified HTTP Response Mocking in Laravel TestsSimplified HTTP Response Mocking in Laravel TestsMar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

cURL in PHP: How to Use the PHP cURL Extension in REST APIscURL in PHP: How to Use the PHP cURL Extension in REST APIsMar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

12 Best PHP Chat Scripts on CodeCanyon12 Best PHP Chat Scripts on CodeCanyonMar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Announcement of 2025 PHP Situation SurveyAnnouncement of 2025 PHP Situation SurveyMar 03, 2025 pm 04:20 PM

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

Notifications in LaravelNotifications in LaravelMar 04, 2025 am 09:22 AM

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),