本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeData::setAccessRoles方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeData::setAccessRoles方法的具体用法?PHP NodeData::setAccessRoles怎么用?PHP NodeData::setAccessRoles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Model\NodeData
的用法示例。
在下文中一共展示了NodeData::setAccessRoles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAccessRoles
/**
* Sets the roles which are required to access this node
*
* @param array $accessRoles
* @return void
* @api
*/
public function setAccessRoles(array $accessRoles)
{
if (!$this->isNodeDataMatchingContext()) {
$this->materializeNodeData();
}
$this->nodeData->setAccessRoles($accessRoles);
$this->context->getFirstLevelNodeCache()->flush();
$this->emitNodeUpdated($this);
}
示例2: 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());
}
示例3: 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());
}