2017 © Pedro Peláez
 

library yii-access-control

image

chervand/yii-access-control

  • Wednesday, July 22, 2015
  • by chervand
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

chervand/yii-access-control

AuthManager configuration

Proper authManager component should be configured (CPhpAuthManger or CDbAuthManager), (*1)

CDbAuthManager (Example)

Apply migrations or create DB tables as described in CDbAuthManager documentation., (*2)

    ...
    'components' => [
        ...
        'authManager' => [
            'class' => 'CDbAuthManager',
            'connectionID' => 'db',
            'itemTable' => 'auth_item',
            'itemChildTable' => 'auth_item_child',
            'assignmentTable' => 'auth_assignment',
            'defaultRoles' => ['guest', 'user', 'support', 'moder', 'admin'],
        ],
        ...
    ],
    ...

Filter configuration

Import a filter in config or in controller, (*3)

    ...
    'import' => [
        ...
        'vendor.chervand.yii-access-control.components.*',
        ...
    ],
    ...

Controller

  • exclude - Excluded routes. Will not be filtered.
  • message - 403 error message.
class Controller extends CController
{
    ...
    public function filters()
    {
        return [
            ...
            [
                'AccessControlFilter',
                'message' => Yii::t('app', 'You are not authorized to perform this action.'),
                'exclude' => [
                    'site/index',
                    'site/error'
                ]
            ],
            ...
        ];
    }
    ...
}

Creating Rules

RBAC Scheme Example, (*4)

The Versions

22/07 2015

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

22/07 2015

v0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires