1. Go to this page and download the library: Download srigi/ipub-security 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/ */
srigi / ipub-security example snippets
$configurator = new Nette\Configurator;
// ...some other code
IPub\Security\DI\SecurityExtension::register($configurator);
class MyPermissionsProvider extends IPub\Security\Providers\PermissionsProvider
{
public function __construct()
{
$intranet = $this->addResource('intranet');
$this->addPermission($intranet, Nette\Security\IAuthorizator::ALL);
$this->addPermission($intranet, 'access');
$this->addPermission($intranet, 'update');
$salesModule = $this->addResource('salesModule', $this->getResource('intranet'));
$this->addPermission($salesModule, 'access');
$this->addPermission($salesModule, 'edit', function($acl, $role, $resource, $privilege) {
// ...code of permission assertion
});
// ... more permissions definitions
}
}