Пример #1
0
 /**
  * @covers System_Acl_Loader_Config::load
  * @covers System_Acl_Loader_Config::_loadConfig
  */
 public function testLoadSomeUnknownFormat()
 {
     $options = array('config' => dirname(__FILE__) . '/data/acl.txt');
     $this->object->setOptions($options);
     $this->setExpectedException('Zend_Config_Exception');
     $this->object->load();
 }
Пример #2
0
 public function load()
 {
     if (isset($this->_options['config'])) {
         $config = $this->_loadConfig($this->_options['config']);
         $this->_options = $this->_mergeOptions($this->_options, $config->toArray());
     }
     return parent::load();
 }
Пример #3
0
 /**
  * Load acl from db
  * @see library/System/Acl/Loader/System_Acl_Loader_LoaderInterface#load()
  */
 public function load()
 {
     $options = array();
     $options[self::ACL] = $this->_loadRules();
     $options[self::ACL][self::RESOURCES] = $this->_loadResources();
     $options[self::ACL][self::ROLES] = $this->_loadRoles();
     $this->_options = $this->_mergeOptions($this->_options, $options);
     return parent::load();
 }
Пример #4
0
 /**
  * @covers System_Acl_Loader_Options::load
  * @covers System_Acl_Loader_Options::<protected>
  */
 public function testLoadRules()
 {
     $this->object->setOptions(array(System_Acl_Loader_Options::ACL => array(System_Acl_Loader_Options::RULE_ALLOW => array('test' => array('test'), 'test1' => array('res-res_res', 'res1')))));
     $this->object->load();
     self::assertTrue($this->acl->isAllowed('test', 'test'));
     self::assertTrue($this->acl->isAllowed('test1', 'res1'));
     self::assertTrue($this->acl->has('res'));
     self::assertTrue($this->acl->inherits('res.res', 'res', true));
     self::assertTrue($this->acl->has('res.res'));
     self::assertTrue($this->acl->has('res.res.res'));
     self::assertFalse($this->acl->isAllowed('test1', 'res'));
     self::assertFalse($this->acl->isAllowed('test1', 'res.res'));
     self::assertTrue($this->acl->isAllowed('test1', 'res.res.res'));
 }