2017 © Pedro Peláez
 

yii2-module yii2-rbacp

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

image

myzero1/yii2-rbacp

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

  • Saturday, March 3, 2018
  • by myzero1
  • Repository
  • 1 Watchers
  • 1 Stars
  • 35 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 3 % Grown

The README.md

yii2-rbacp

Access modules,including functional access and data access., (*1)

Show time

, (*2)

Installation

The preferred way to install this module is through composer., (*3)

Either run, (*4)

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

or add, (*5)

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

to the require section of your composer.json file., (*6)

Setting

Once the extension is installed, simply modify your application configuration as follows:, (*7)

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:, (*8)

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

or if you have enabled pretty URLs, you may use the following URL:, (*9)

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., (*10)

The Versions

03/03 2018

dev-develop

dev-develop

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

  Sources   Download

MIT BSD-3-Clause

The Requires

  • yiisoft/yii2 ~2.0
  • bower-asset/admin-lte ^2.3.11
  • bower-asset/font-awesome ^4.0
  • bower-asset/html5shiv ^3.0
  • bower-asset/jquery-slimscroll ^1.3
  • bower-asset/flot ^0.8

 

by Xuanwu Qin

03/03 2018

dev-master

9999999-dev

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

  Sources   Download

MIT BSD-3-Clause

The Requires

  • yiisoft/yii2 ~2.0
  • bower-asset/admin-lte ^2.3.11
  • bower-asset/font-awesome ^4.0
  • bower-asset/html5shiv ^3.0
  • bower-asset/jquery-slimscroll ^1.3
  • bower-asset/flot ^0.8

 

by Xuanwu Qin

03/03 2018

1.0.4

1.0.4.0

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

  Sources   Download

BSD-3-Clause

The Requires

  • yiisoft/yii2 ~2.0
  • bower-asset/admin-lte ^2.3.11
  • bower-asset/font-awesome ^4.0
  • bower-asset/html5shiv ^3.0
  • bower-asset/jquery-slimscroll ^1.3
  • bower-asset/flot ^0.8

 

by Xuanwu Qin

01/03 2018

1.0.3

1.0.3.0

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

  Sources   Download

BSD-3-Clause

The Requires

  • yiisoft/yii2 ~2.0
  • bower-asset/admin-lte ^2.3.11
  • bower-asset/font-awesome ^4.0
  • bower-asset/html5shiv ^3.0
  • bower-asset/jquery-slimscroll ^1.3
  • bower-asset/flot ^0.8

 

by Xuanwu Qin

27/02 2018

dev-feature/add_uilog

dev-feature/add_uilog

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

  Sources   Download

BSD-3-Clause

The Requires

  • yiisoft/yii2 ~2.0
  • bower-asset/admin-lte ^2.3.11
  • bower-asset/font-awesome ^4.0
  • bower-asset/html5shiv ^3.0
  • bower-asset/jquery-slimscroll ^1.3
  • bower-asset/flot ^0.8

 

by Xuanwu Qin

27/02 2018

dev-feature/just_rbacp

dev-feature/just_rbacp

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

  Sources   Download

BSD-3-Clause

The Requires

  • yiisoft/yii2 ~2.0
  • bower-asset/admin-lte ^2.3.11
  • bower-asset/font-awesome ^4.0
  • bower-asset/html5shiv ^3.0
  • bower-asset/jquery-slimscroll ^1.3
  • bower-asset/flot ^0.8

 

by Xuanwu Qin

27/02 2018

1.0.2

1.0.2.0

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

  Sources   Download

BSD-3-Clause

The Requires

  • yiisoft/yii2 ~2.0
  • bower-asset/admin-lte ^2.3.11
  • bower-asset/font-awesome ^4.0
  • bower-asset/html5shiv ^3.0
  • bower-asset/jquery-slimscroll ^1.3
  • bower-asset/flot ^0.8

 

by Xuanwu Qin

30/01 2018

1.0.1

1.0.1.0

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

  Sources   Download

BSD-3-Clause

The Requires

  • yiisoft/yii2 ~2.0
  • bower-asset/admin-lte ^2.3.11
  • bower-asset/font-awesome ^4.0
  • bower-asset/html5shiv ^3.0
  • bower-asset/jquery-slimscroll ^1.3
  • bower-asset/flot ^0.8

 

by Xuanwu Qin

30/01 2018

1.0.0

1.0.0.0

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

  Sources   Download

BSD-3-Clause

The Requires

  • yiisoft/yii2 ~2.0
  • bower-asset/admin-lte ^2.3.11
  • bower-asset/font-awesome ^4.0
  • bower-asset/html5shiv ^3.0
  • bower-asset/jquery-slimscroll ^1.3
  • bower-asset/flot ^0.8

 

by Xuanwu Qin