本文整理汇总了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'));
}
示例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));
}
示例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'));
}