当前位置: 首页>>代码示例>>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;未经允许,请勿转载。