當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Acl::inherits方法代碼示例

本文整理匯總了PHP中Zend_Acl::inherits方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Acl::inherits方法的具體用法?PHP Zend_Acl::inherits怎麽用?PHP Zend_Acl::inherits使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Acl的用法示例。


在下文中一共展示了Zend_Acl::inherits方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testLoadRules

 /**
  * @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'));
 }
開發者ID:kandy,項目名稱:system,代碼行數:18,代碼來源:OptionsTest.php

示例2: testResourceInherits

 /**
  * Tests basic Resource inheritance
  *
  * @return void
  */
 public function testResourceInherits()
 {
     $resourceCity = new Zend_Acl_Resource('city');
     $resourceBuilding = new Zend_Acl_Resource('building');
     $resourceRoom = new Zend_Acl_Resource('room');
     $this->_acl->add($resourceCity)->add($resourceBuilding, $resourceCity->getResourceId())->add($resourceRoom, $resourceBuilding);
     $this->assertTrue($this->_acl->inherits($resourceBuilding, $resourceCity, true));
     $this->assertTrue($this->_acl->inherits($resourceRoom, $resourceBuilding, true));
     $this->assertTrue($this->_acl->inherits($resourceRoom, $resourceCity));
     $this->assertFalse($this->_acl->inherits($resourceCity, $resourceBuilding));
     $this->assertFalse($this->_acl->inherits($resourceBuilding, $resourceRoom));
     $this->assertFalse($this->_acl->inherits($resourceCity, $resourceRoom));
     $this->_acl->remove($resourceBuilding);
     $this->assertFalse($this->_acl->has($resourceRoom));
 }
開發者ID:jon9872,項目名稱:zend-framework,代碼行數:20,代碼來源:AclTest.php

示例3: testLoadRules

 /**
  * @covers System_Acl_Loader_Db::load
  * @covers System_Acl_Loader_Db::<protected>
  */
 public function testLoadRules()
 {
     $this->createTableMocks('AclRole');
     $this->createTableMocks('AclResource');
     $this->createTableMocks('AclRule', array(array('role' => 'test', 'resource' => 'test', 'access' => true), array('role' => 'test1', 'resource' => 'res-res_res', 'access' => true), array('role' => 'test1', 'resource' => 'res1', 'access' => true)));
     $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'));
 }
開發者ID:kandy,項目名稱:system,代碼行數:20,代碼來源:DbTest.php


注:本文中的Zend_Acl::inherits方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。