我试着理解它是如何工作的--我不可能只看到以/rbac/ .还有一些带有/网格视图/ ..。和/痢疾/ ..。但是,与我的contoller操作无关的是,我认为yii2mod/yii2-rbac的工作方式类似于Yii1中的RBAC,在这里,我定义和签入控制器的权限。
当-和以前一样-我插入了这样的东西:
INSERT INTO `auth_item` (`name`, `type`, `description`, `rule_name`, `data`) VALUES ('createCompany', 0, 'createCompany', NULL, 'N;');并将其分配给用户管理--在Admin的权限视图中,它显示为权限而不是路由(rbac/权限/视图/管理)
自述文件对我没有帮助-那么我如何使用yii2mod/yii2-rbac呢?
发布于 2019-01-10 03:56:19
它所提供的yii2mod/yii2-rbac包是一个web接口,但不是--它是Yii2中RBAC的本地实现的替代方案:
Yii2-RBAC提供了一个用于高级访问控制的web接口,并包括以下功能:
这个包的基础是RBAC Yii2,它可以检查它的部分实现这里 (仅作为一个示例)。
为INSERT表创建一个原始的auth_item并不能很好地理解RBAC是如何工作的。auth_item表保存由类型( 1=Role、2=permission )分隔的权限和/或角色的记录。
在您的项目中安装和配置yii2mod/yii2-rbac时,您可以输入不同的选项来创建角色、权限、路由,并将它们分配给您的用户:
http://localhost/path/to/index.php?r=rbac/
http://localhost/path/to/index.php?r=rbac/route
http://localhost/path/to/index.php?r=rbac/permission
http://localhost/path/to/index.php?r=rbac/role
http://localhost/path/to/index.php?r=rbac/assignment或者,如果启用了漂亮的URL,则可以使用以下URL:
http://localhost/path/to/index.php/rbac
http://localhost/path/to/index.php/rbac/route
http://localhost/path/to/index.php/rbac/permission
http://localhost/path/to/index.php/rbac/role
http://localhost/path/to/index.php/rbac/assignment如果您想更好地理解YB2 RBAC的工作原理,可以从这里查看它。
https://stackoverflow.com/questions/53963707
复制相似问题