Download the PHP package antonyz89/yii2-rbac without Composer
On this page you can find all versions of the php package antonyz89/yii2-rbac. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-rbac
yii2-rbac
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Usage
Add bootstrap and module in to main.php
Applying Rules
1 - Add AccessControl to your Controller's Behaviour
`
2 - Create a rbac_profile_id to your identity class
php yii migrate/create add_rbac_profile_id_to_user_table
3 - use php yii migrate
3.1 - Now, include it on _form.php
and Class
of your identity.
3.2 - Add getRbacProfile()
3.3 - include it on rules()
4 - Access http://localhost/rbac
or http://localhost?r=rbac
and create a Profile with Controllers and Actions that
you want whoever has this Profile to be able to access these Controllers and Actions
5 - When your Identity tries to access an existing Controller/Action in his Profile nothing will happen, but if you try to access a Controller/Action that does not exist in his Profile, an error will appear:
Error at access http://localhost/category/update?id=16
--
If you use AdminLTE, you can use my modified menu widget that works with RBAC and hides/displays menus according to the controllers/actions contained in the logged Identity's Profile, in addition to supporting roles like "@" and "?"
You can generate a migration with your current data of RBAC clicking on 'Generate Migration' button:
You can find the migration at 'console/migrations'
and run using php yii migrate
Conditional Blocks
You can create blocks for each controller added to the profile. Each block can contain a specific condition to allow access to the user to that controller and yours actions.
In this case, all users with user_level = 2
or email = '[email protected]'
can access this block.
All versions of yii2-rbac with dependencies
yiisoft/yii2 Version ~2.0.6
yiisoft/yii2-bootstrap4 Version ^2.0
antonyz89/yii2-many-to-many Version ^0.3
rawr/t-regx Version ^0.9
kartik-v/yii2-widget-select2 Version ^2.1.0
kartik-v/yii2-grid Version ^3.2
symfony/polyfill-php80 Version ^1.18