rbac

Doubts about Yii2 RBAC

♀尐吖头ヾ 提交于 2019-12-05 15:30:03
问题 I've been developing web apps using Yii 1.1.14 so far, but now it's time for an upgrade. The company where I work has developed its own Access Control system, and I was really OK with it until I saw what it was really like... A combination of 8 tables in the database (not counting the users table), with a bunch of foreign keys. 1 table for controllers 1 table for the actions 1 table for the menu categories 1 table for types of users And the other tables basically just connect 2 or 3 of those

Dynamic generation of RBAC roles and permissions

。_饼干妹妹 提交于 2019-12-05 07:12:37
I’m looking for a methodology for generating new RBAC roles on demand. I am developing a RBAC system that will have two primary parameters. Rather than simply having a user associated with a role, and that role associated with a group of permissions; a user can be associated with a role “for a specific project,” and the user can then have the permissions of that role for that project only (or for other projects that the user holds that role for). A user can have a specific role on one project, and a different role on another project; the permissions granted to a role are consistent for every

yii2-搭建实现RBAC权限控制:yii2-adminlte-asset / 菜单栏(拓展篇)

时光总嘲笑我的痴心妄想 提交于 2019-12-05 06:58:33
(一)安装扩展组件:yii2-adminlte-asset 描述:我们搭好的项目是没办法直接支持左侧菜单栏的样式的。需要我们去找样式或者直接用组件来安装,这里我们选择了yii2-adminlte-asset 安装流程: ① 到项目根目录,命令行执行:composer require dmstr/yii2-adminlte-asset "2.*" 即可。 ② 待安装完毕,将 vendor\dmstr\yii2-adminlte-asset\example-views\yiisoft\yii2-app 目录下面的文件到项目 backend\views ③ 下面上对比图(左图是未安装前,右图是安装后) ④ 通过修改body的class可以来调整主题 //主要是这几种样式,挑这看自己喜欢的就行 "skin-blue","skin-black","skin-red","skin-yellow","skin-purple","skin-green","skin-blue-light","skin-black-light","skin-red-light","skin-yellow-light","skin-purple-light","skin-green-light" (二)结合前面所学的权限控制,把左侧菜单栏真正实现由角色来区分显示(替换掉Menu的静态显示) <?php

ThinkPHP 3.0 + Rbac 应用示例

房东的猫 提交于 2019-12-05 03:58:41
此为Rbac在ThinkPHP中应用的实例,用到了ThinkPHP的Rbac扩展,样式比较难看,大家将就的看。此例子旨在学习交流使用,勿用于实际项目中。 Rbac简单说来就是基于“角色”的权限控制,所有用户都属于某一用户组,之后给用户组授权,则组内成员都有相应权限。而ThinkPHP的Rbac的核心,即为在每个操作前都进行权限验证操作,用_initialize方法实现。而权限位则在登录时写到session中,如果对权限的实时性要求非常高,也可以设置每一次验证都到数据库里查。 程序源码: http://vdisk.weibo.com/s/fOMnN 相关配置项: 'USER_AUTH_ON' => true,//开启验证 'USER_AUTH_TYPE' => 1,//验证类型 'USER_AUTH_KEY' => 'uid', // REQUIRE_AUTH_MODULE 需要认证模块,不设置即为除了NOT_AUTH_MODULE中的模块外全部验证 'NOT_AUTH_MODULE' => 'Public', 'USER_AUTH_GATEWAY' => '/Public/login', //认证网关 // RBAC_DB_DSN 数据库连接DSN,默认使用配置文件 'RBAC_ROLE_TABLE' => 'think_role', //角色表名称 'RBAC_USER

How to get users of a specefic role in Yii2 and DbManager?

徘徊边缘 提交于 2019-12-05 01:02:55
How to get users of a specefic role in Yii2 and DbManager in RBAC? Please introduce some API for user management and role management. I searched and read Yii2 guide but I didn't find any solution. I wrote this function which can be added to an User class. /** * Finds all users by assignment role * * @param \yii\rbac\Role $role * @return static|null */ public static function findByRole($role) { return static::find() ->join('LEFT JOIN','auth_assignment','auth_assignment.user_id = id') ->where(['auth_assignment.item_name' => $role->name]) ->all(); } Since Yii version 2.0.7, DbManager and

Role-based security implementation in LDAP

断了今生、忘了曾经 提交于 2019-12-04 23:04:13
问题 I'm working on role-based security implementation in LDAP and Java. Specifically, I have the following objects that I need to represent in LDAP: Users Corporate groups of users - HR, Finance etc. Permissions - DOCUMENT_READ, DOCUMENT_MODIFY etc. Roles - ADMIN, GUEST etc. Roles are basically groups of permissions, and they can be assigned to a user or to a group of users. I was thinking of representing them in LDAP as folows: Users - Person and uidObject classes with userPassword attribute.

X-Admin&ABP框架开发-RBAC

99封情书 提交于 2019-12-04 18:36:12
  在业务系统需求规划过程中,通常对于诸如组织机构、用户和角色等这种基础功能,通常是将这部分功能规划到通用子域中,这也说明了,对于这部分功能来讲,是系统的基石,整个业务体系是建立于这部分基石之上的,当然,还有诸如多语言、设置管理、认证和授权等。对于这部分功能,ABP中存在这些概念,并且通过Module Zero模块完成了这些概念。 一、角色访问控制之RBAC   RBAC:Role Based Access Control,基于角色的访问控制,这在目前大多数软件中来讲已经算得上是普遍应用了,最常见的结构如下,结构简单,设计思路清晰。      但是也存在其它升级版的设计,诸如用户权限表、角色组、用户组的概念等,具体分类有RBAC0、RBAC1、RBAC2等,后者功能越来越强大,也越来越复杂。 RBAC0:是RBAC的核心思想。 RBAC1:是把RBAC的角色分层模型。 RBAC2:增加了RBAC的约束模型。 RBAC3:整合RBAC2 + RBAC1。 二、ABP中的RBAC   在Abp中,已经集成了这些概念,并在ModuleZero模块中实现了这些概念,基于IdentityServer4的ModuleZero模块完成了封装。对于我们大多数以业务为中心的开发人员来讲,不应该又去造一个轮子,而是应该开好这辆车。首先看下Abp中的RBAC模型     

对于RBAC与shiro的一些思考

随声附和 提交于 2019-12-04 18:21:36
一、什么是RBAC模型   RBAC模型是一个解决用户权限问题的设计思维。   在最简单的RBAC模型中,将用户表设计为如下几个表   1、用户   2、角色   3、权限   以及这三张表衍生出来的两张中间表   4、用户_角色表   5、权限_角色表   上面描述的5张表就构成了最基本也是最成熟的RBAC模型,可以看得出RBAC模型中的核心是角色,所有与用户相关的权限都是通过角色表进行关联的!在今后我们可能会用到的按钮元素表,样式表等各种各样的资源表最终都如权限表一般,与角色进行关联。RBAC的哲学就是,认角色不认用户,所有的查询都是通过角色来完成的。 1.1、RBAC模型的注意点   我们之所以要用到RBAC模型,本质上是为了实现两个功能:   1、资源对用户的可见性,例如:当前用户对应的角色是否能“看到“某个菜单项或是某个按钮,这一部分其实重在前端渲染,资源的可见性并不能保证资源安全,当有心人拿到资源的请求路径时依旧可以发出相应的请求。在我看来,对资源的可见性,更多的是对用户的体验上的优化。   2、对请求的鉴权,这部分才应该是我们关注的核心点。   需要注意的是,对于资源可见性的控制上,我们只要简单的将五张表进行关联查询,然后通过foreach渲染出用户可见的按钮即可,没有什么复杂的操作。无论是前后端分离的项目还是,传统项目或是各种模板引擎,都建议这样做

DB schema for RBAC with multiple levels of roles

浪尽此生 提交于 2019-12-04 12:12:11
问题 I'm trying to come up with a DB schema for an RBAC, and I want to be able to create "departments" and "positions". Positions will extend the generic privileges of departments. Should I just create a single "roles" table, holding both the positions and departments? Or should I create 3 tables: positions, departments, and roles, with the positions and departments table having a foreign key to the roles table? Thx in advance for your help everyone! Cheers. 回答1: My experience while experimenting

Role Based Access Control (RBAC) - .Net Component [closed]

不打扰是莪最后的温柔 提交于 2019-12-04 06:00:48
In my job we are trying to consolidate the Authentication of the application farm with Windows Identity Fundation (WIF) or some custom component based in Membership Provider. With this, we need to provide the developers (and final users) some component that can help us with the logic of managment views by Role (RBAC - Role Based Access Control). I couldn't find anything. That's the idea: A user 'admin' can view 'Home' and 'Administration' pages. Well, like a developer, i don't want to write code to do this profiling. To do this, i expect to work with a component, that encapsulates this