chervand / yii-access-control
v0.1.0
2015-07-22 13:54 UTC
Requires
- yiisoft/yii: 1.1.*
This package is not auto-updated.
Last update: 2024-11-13 10:52:16 UTC
README
AuthManager configuration
Proper authManager component should be configured (CPhpAuthManger or CDbAuthManager)
CDbAuthManager (Example)
Apply migrations or create DB tables as described in CDbAuthManager documentation.
... '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
... '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' ] ], ... ]; } ... }