enigmatix / yii2-rbac
Yii2 RBAC helper
Installs: 297
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/enigmatix/yii2-rbac
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2025-10-12 01:18:45 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']
]);