Skip to content

Helper Class to build your RBAC using easy configuration arrays

License

Notifications You must be signed in to change notification settings

enigmatix/yii2-rbac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yii2-rbac

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']
    ]);

About

Helper Class to build your RBAC using easy configuration arrays

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages