1. Go to this page and download the library: Download zfstarter/zfs-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/ */
$this->getEventManager()->getSharedManager()->attach(
ZFS\Rbac\Rbac::EVENT_MANAGER_IDENTIFIER,
ZFS\Rbac\Rbac::EVENT_GET_USER_ROLES,
function () {
return array('admin');
}
);
class IndexController extends AbstractActionController
{
public function indexAction()
{
if (!$this->isGranted('index_action')) {
return $this->notFoundAction();
}
/* ... */
}
}