1. Go to this page and download the library: Download phpmv/ubiquity-acl 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/ */
use Ubiquity\security\acl\AclManager;
use Ubiquity\security\acl\persistence\AclCacheProvider;
AclManager::start();
AclManager::initFromProviders([
new AclCacheProvider()
]);
namespace controllers;
/**
* @resource('Main')
* @allow('role'=>'@USER')
*/
class TestAclController extends ControllerBase {
use AclControllerTrait;
}
namespace controllers;
use Ubiquity\attributes\items\acl\Resource;
use Ubiquity\attributes\items\acl\Allow;
#[Resource('Main')]
#[Allow(role: '@USER')]
class TestAclController extends ControllerBase {
use AclControllerTrait;
}
namespace controllers;
use Ubiquity\attributes\items\acl\Resource;
use Ubiquity\attributes\items\acl\Allow;use Ubiquity\utils\http\USession;
use Ubiquity\utils\http\USession;
#[Resource('Main')]
#[Allow(role: '@USER')]
class TestAclController extends ControllerBase {
use AclControllerTrait;
public function _getRole(){
$activeUser=USession::get('activeUser');
if(isset($activeUser)){
return $activeUser->getRole();
}
}
}
use Ubiquity\controllers\Startup;
use Ubiquity\security\acl\AclManager;
$config=Startup::$config;
AclManager::initializeDAOProvider($config, 'default');
use Ubiquity\security\acl\AclManager;
use Ubiquity\security\acl\persistence\AclCacheProvider;
use Ubiquity\security\acl\persistence\AclDAOProvider;
use Ubiquity\orm\DAO;
DAO::start();//Optional, to use only if dbOffset is not default
AclManager::start();
AclManager::initFromProviders([
new AclCacheProvider(), new AclDAOProvider($config)
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.