3 Star 7 Fork 3

世界不可能那么远 / rbac

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

rbac

RBAC component for PHP applications.

权限管理组件

安装

  • 在项目的composer.json文件中的require项中添加:
"furthestworld/rbac": "~1.0"

并更新composer依赖:composer update

  • 在需要使用RBAC服务的地方添加:

require_once __ROOT__ . '/vendor/autoload.php';
use Rbac\RbacService;
  • 初始化RBAC服务:
$db_config = [
    "dbtype" = mysql,
    "host" = "mysql host",
    "port" = "mysql port",
    "username" = "mysql username",
    "password" = "mysql password",
    "dbname" = "your db name",
    "charset" => "utf8"
];
$rbac_config = [
    //rbac认证配置
    'USER_AUTH_ON'      => true,
    'USER_AUTH_TYPE'    => 2,                  // 默认认证类型 1 登录认证 2 实时认证
    'USER_AUTH_KEY'     => 'user_auth_key',    // 用户认证SESSION标记
    'ADMIN_AUTH_KEY'    => 'administrator',
    'ADMIN_USER_ID'     => 22,                 //超级管理员ID
    'RBAC_ROLE_TABLE'   => 'rbac_role',         
    'RBAC_USER_TABLE'   => 'rbac_role_user',
    'RBAC_ACCESS_TABLE' => 'rbac_access',
    'RBAC_NODE_TABLE'   => 'rbac_node',
];

//$cacheService = new RbacCacheService();   //如果需要缓存,则传入实例化后的第三方缓存服务对象

RbacService::init($db_config, $rbac_config, $cacheService);
  • enjoy~ :)

RBAC对应数据表: src/data/rbac.sql

MIT License Copyright (c) 2016 xuanskyer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

RBAC component for PHP applications. 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/xuanskyer/rbac.git
git@gitee.com:xuanskyer/rbac.git
xuanskyer
rbac
rbac
master

搜索帮助