Download the PHP package dmstr/yii2-active-record-permissions without Composer
On this page you can find all versions of the php package dmstr/yii2-active-record-permissions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dmstr/yii2-active-record-permissions
More information about dmstr/yii2-active-record-permissions
Files in dmstr/yii2-active-record-permissions
Package yii2-active-record-permissions
Short Description _____
License BSD-3-Clause
Homepage https://www.dmstr.io/
Informations about the package yii2-active-record-permissions
Yii 2 Active Record Access Permissions
The package has been extracted from https://github.com/dmstr/yii2-db
Installation
Setup
General usage
Configuration options
In application config:
Note: Static property usage
enableRecursiveRoles
is deprecated.
Example
Traits
dmstr\activeRecordPermissions\ActiveRecordAccessTrait
Option 1:
How to equip your active record model with access control
-
Use update migration in
db/migrations/m160609_090908_add_access_columns
- set all
$tableNames
to be updated and run migration
- set all
This migrations adds the available access check columns to your database table(s)
-
Add
use \dmstr\activeRecordPermissions\ActiveRecordAccessTrait;
to your active record model - (update your cruds)
RBAC permissions
Permissions for selections
access.availableDomains:any
Permissions to set default values
access.defaults.accessDomain:global
access.defaults.updateDelete:<ROLE>
Add rule for default value in Model::rules()
, if you want to set it automatically
Option 2:
Simply override this method in our AR model and set the access fields you have/want to the field names you have/want!
Default:
Customize:
:secret: Congrats, you are now ready to manage specific access checks on your active records!
:bulb: Access options:
- All access option
*
-
specific rbac roles and permissions assignable
- single or multi
*
Role1,Role2,Permission1,...
- single or multi
-
limit access to specific domain / language
de
oren
Owner
gets all access over other given permissions- every active record can have exact one owner right which stands above
access_read
,access_update
,access_delete
- every active record can have exact one owner right which stands above
Planned updates:
- ActiveRecordAccessTrait
- in cruds use select2 multi for inputs (domain, read, update, delete)
- Setter: authItemArrayToString()
- Getter: authItemStringToArray()
- in cruds use select2 multi for inputs (domain, read, update, delete)
Built by dmstr