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
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

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.

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.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft