本文整理匯總了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'));
}