承接 myzero1/yii2-rbacp 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

myzero1/yii2-rbacp

Composer 安装命令:

composer require myzero1/yii2-rbacp

包简介

Simple captcha for yii2.Just add the module in config file and use the widget.

README 文档

README

Access modules,including functional access and data access.

Show time

Installation

The preferred way to install this module is through composer.

Either run

php composer.phar require myzero1/yii2-rbacp:1.*

or add

"myzero1/yii2-rbacp": "~1"

to the require section of your composer.json file.

Setting

Once the extension is installed, simply modify your application configuration as follows:

return [
    ......
    'bootstrap' => [
        ......
        'rbacp' => [
            'class' => '\myzero1\rbacp\Bootstrap', // for rbacp function
            'params' => [
               'urlManager' => [
                    'rules' => [
                        // 'rate/area/index' => 'rate/jf-core-area/index',
                    ],
                ],
                'rbacp' => [
                    'model' => 'rbac',//everyone,logined,rbac,rbacp
                    'develop' => 1,//The id of the developer
                    'rbacpTester' => 2,//The id of the tester of rbacp
                    'denyCallbackUri' => '/rbacp/default/rbacp403',
                    'loginUri' => '/site/login',
                    // 'beforeCheckActionFunc' => function(){
                    //     $url = \yii\helpers\Url::to(['/site/error403','isLocked'=>1], true);
                    //     $uri = '/site/error403';
                    //     if ( strpos($_SERVER['REQUEST_URI'], $uri) === false) {
                    //         if (!\Yii::$app->user->isGuest && Yii::$app->user->identity->isLocked) {
                    //             \Yii::$app
                    //             ->getResponse()
                    //             ->redirect($url)
                    //             ->send();
                    //         }
                    //     }
                    // },
                    // 'afterCheckActionFunc' => function(){},
                    'accessRules' => [
                        'excludeUri' => [
                            '/rbacp/default/index',
                            '/rbacp/default/rbacp403',
                            '/site/captcha',
                            '/site/login-ajax',
                        ],
                        'developUri' => [
                            '/rbacp/default/migrate-up',
                            '/rbacp/default/migrate-down',
                        ],
                        'loginedExcludeUri' => [
                            '/site/logout',
                            '/site/index',
                            '/adminlteiframe/layout',
                        ],
                    ],
                ],
            ],
        ],
        ......
    ],
    'modules' => [
        ......
        'rbacp' => [ // you should seting it,when you are developing.
            'class' => '\myzero1\rbacp\Module',
            'theme' => 'adminlteiframe', // adminlteiframe, adminlte
        ],
        ......
    ],
    ......
];

Usage

You can access Demo through the following URL:

http://localhost/path/to/index.php?r=rbacp/default/index

or if you have enabled pretty URLs, you may use the following URL:

http://localhost/path/to/index.php/rbacp/default/index
Use the rbac of rbacp:

Setting 'model' => 'rbac',//everyone,logined,rbac,rbacp
    everyone: veryone can access.
    logined: Only the logined can access.
    rbac: Control access by rbac,you should to setting more.
        Add tables by "/rbacp/default/migrate-up".
        Add privilege by "rbacp-privilege/index".
        Add role by "rbacp/rbacp-role/index".
        Assign role by "rbacp/rbacp-user-view/index".
    The rbac it working,now.

Use the rbacp of rbacp:

Setting 'model' => 'rbacp',//everyone,logined,rbac,rbacp
    rbacp: Control access by rbacp,you should to setting more.
        Add tables by "/rbacp/default/migrate-up".
        Add privilege by "rbacp-privilege/index".
        Add policy by "rbacp/rbacp-policy/index".//to control the access of data
        Add role by "rbacp/rbacp-role/index".
        Assign role by "rbacp/rbacp-user-view/index".
    You can use rbacp as flow.
        Use it by andFilterWhere
            RbacpRole::find()->andFilterWhere([
                '<>',
                'rbacp_role.id',
                'rbacp_policy_sku=rbacp|rbacp-role|index|rbacpPolicy|read|角色列表'// to use rbacp, set policy_sku.
            ])
        Use it by GridView::widget
            GridView::widget([
                'dataProvider' => $dataProvider,
                'options' => [
                    'rbacp_policy_sku' => 'rbacp|rbacp-role|index|rbacpPolicy|list|角色列表'// to use rbacp, set policy_sku.
                ],
                'columns' => [...],
            ]);
        Use it by BaseHtml::tag
            yii\helpers\BaseHtml::tag('a', '创建', array(
                    'href' => yii\helpers\Url::toRoute(['create']),
                    'class' => 'btn btn-success btn-sm',
                    'rbacp_policy_sku' => 'rbacp|rbacp-role|index|rbacpPolicy|tag|角色列表创建按钮'// to use rbacp, set policy_sku.
                ));


Set the role id:
\myzero1\rbacp\components\Rbac::setRoleId($roleId);

Set and get the role id by user id:
\myzero1\rbacp\components\Rbac::getRoleByUid($userId);

Notice: The rbacp module will call \myzero1\rbacp\components\Rbac::getRoleByUid(\Yii::$app->user->id); to set role by default.

myzero1/yii2-rbacp 适用场景与选型建议

myzero1/yii2-rbacp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 307 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 myzero1/yii2-rbacp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 myzero1/yii2-rbacp 我们能提供哪些服务?
定制开发 / 二次开发

基于 myzero1/yii2-rbacp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 307
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-11-29