1. Go to this page and download the library: Download dotkernel/dot-rbac library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dotkernel / dot-rbac example snippets
'dot_authorization' => [
//name of the guest role to use if no identity is provided
'guest_role' => 'guest',
'role_provider_manager' => [],
//example for a flat RBAC model using the InMemoryRoleProvider
'role_provider' => [
'type' => 'InMemory',
'options' => [
'roles' => [
'admin' => [
'permissions' => [
'edit',
'delete',
//etc..
]
],
'user' => [
'permissions' => [
//...
]
]
]
],
],
//example for a hierarchical model, less to write but it can be confusing sometimes
/*'role_provider' => [
'type' => 'InMemory',
'options' => [
'roles' => [
'admin' => [
'children' => ['user'],
'permissions' => ['create', 'delete']
],
'user' => [
'children' => ['guest']
'permissions' => ['edit']
]
'guest' => [
'permissions' => ['view']
]
]
]
],*/
'assertion_manager' => [
'factories' => [
//EditAssertion::class => InvokableFactory::class,
],
],
'assertions' => [
[
'type' => EditAssertion::class,
'permissions' => ['edit'],
'options' => []
]
]
]