本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeData::isAccessible方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeData::isAccessible方法的具体用法?PHP NodeData::isAccessible怎么用?PHP NodeData::isAccessible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Model\NodeData
的用法示例。
在下文中一共展示了NodeData::isAccessible方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAccessibleReturnsTrueIfRoleIsEveryone
/**
* @test
*/
public function isAccessibleReturnsTrueIfRoleIsEveryone()
{
$mockSecurityContext = $this->getMock('TYPO3\\Flow\\Security\\Context');
$mockSecurityContext->expects($this->any())->method('isInitialized')->will($this->returnValue(TRUE));
$mockSecurityContext->expects($this->at(0))->method('hasRole')->with('SomeRole')->will($this->returnValue(FALSE));
$mockSecurityContext->expects($this->at(1))->method('hasRole')->with('Everyone')->will($this->returnValue(TRUE));
$this->nodeData->_set('securityContext', $mockSecurityContext);
$this->nodeData->setAccessRoles(array('SomeRole', 'Everyone', 'SomeOtherRole'));
$this->assertTrue($this->nodeData->isAccessible());
}
示例2: isAccessibleReturnsTrueIfRoleIsEveryone
/**
* @test
*/
public function isAccessibleReturnsTrueIfRoleIsEveryone()
{
/** @var Context|\PHPUnit_Framework_MockObject_MockObject $mockSecurityContext */
$mockSecurityContext = $this->createMock('TYPO3\\Flow\\Security\\Context');
$mockSecurityContext->expects($this->at(0))->method('canBeInitialized')->will($this->returnValue(true));
$mockSecurityContext->expects($this->at(1))->method('hasRole')->with('SomeRole')->will($this->returnValue(false));
$mockSecurityContext->expects($this->at(2))->method('hasRole')->with('Everyone')->will($this->returnValue(true));
$this->inject($this->nodeData, 'securityContext', $mockSecurityContext);
$this->nodeData->setAccessRoles(array('SomeRole', 'Everyone', 'SomeOtherRole'));
$this->assertTrue($this->nodeData->isAccessible());
}
示例3: isAccessible
/**
* Tells if this node may be accessed according to the current security context.
*
* @return boolean
* @api
*/
public function isAccessible()
{
return $this->nodeData->isAccessible();
}