public static function init() { $aclProvider = new Application_Security_AclProvider(); $acl = $aclProvider->getAcls(); $aclProvider->getLogger()->debug('ACL: bootrapping'); Zend_Registry::set('Opus_Acl', $acl); Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl($acl); Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole(Application_Security_AclProvider::ACTIVE_ROLE); }
/** * Liefert Liste mit Ressourcen für die Rechteverwaltung. * * Ressourcen für die Rechte vergeben können. Module und Workflow-Übergänge werden separat behandelt. * * @return array of strings */ private function getAllResources() { $allResources = array(); $aclProvider = new Application_Security_AclProvider(); $resources = $aclProvider->getAllResources(); foreach ($resources as $resource) { $allResources[] = 'resource_' . $resource; } return $allResources; }
/** * Initialisiert Zend_Acl für die Authorization in OPUS. * * TODO use Application_Security_AclProvider */ protected function _initAuthz() { $this->bootstrap('Logging', 'Navigation', 'view'); $config = $this->getResource('configuration'); if (isset($config->security) && $config->security == 1) { Application_Security_AclProvider::init(); } else { Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl(null); Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole(null); } }
/** * Login user. * * @param string $login * @param string $password * * TODO should be possible to be just 'guest' (see also enableSecurity) */ public function loginUser($login, $password) { $adapter = new Opus_Security_AuthAdapter(); $adapter->setCredentials($login, $password); $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($adapter); $this->assertTrue($auth->hasIdentity()); $config = Zend_Registry::get('Zend_Config'); if ($config->security) { Application_Security_AclProvider::init(); } }
public function testGetAllResources() { $aclResources = Application_Security_AclProvider::$resourceNames; $allResources = array(); foreach ($aclResources as $resources) { $allResources = array_merge($allResources, $resources); } $aclProvider = new Application_Security_AclProvider(); $this->assertEquals($allResources, $aclProvider->getAllResources()); }