enigmatix / yii2-rbac
Yii2 RBAC helper
1.0.1
2016-08-05 03:48 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2025-01-18 20:35:42 UTC
README
Helper Class to build your RBAC using easy configuration arrays.
Some quick examples:
Creates a single role with associated permissions. The default construction is:
A role with sub-roles:
['Support', ['Basic','SupportManager']],
A role with permissions:
['UserManager', 'permissions' => ['assumeUserIdentity','resetUserPassword']],
A role with a rule:
['Basic', 'ruleName' => 'notGuest']
Or an entry with all three:
['Support', ['Basic','SupportManager'],
'ruleName' => 'notGuest',
'permissions' => ['assumeUserIdentity','resetUserPassword']]
And then add them via the Rbac Builder:
RbacBuilder::addRules([
['notGuest' => GuestRule::className()]
]);
RbacBuilder::createRoles(['Support', ['Basic','SupportManager'],
'ruleName' => 'notGuest',
'permissions' => ['assumeUserIdentity','resetUserPassword']
]);