PHP code example of geniv / nette-identity-authorizator
1. Go to this page and download the library: Download geniv/nette-identity-authorizator 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/ */
geniv / nette-identity-authorizator example snippets
use AuthorizatorTrait; // trait for add ACL from Tracy
$acl = $this->user->getAuthorizator();
$acl->isAllowed('role', 'resource', 'privilege');
$this->user->isAllowed('resource', 'privilege');
$acl = $this->user->getAuthorizator();
// manual set allowed with internal resolve policy
$acl->setAllowed(IAuthorizator::ALL, 'Homepage');
$acl->setAllowed(IAuthorizator::ALL, 'Login');
if (!$this->user->isAllowed($this->name, $this->action)) {
// NOT ALLOWED
}