本文整理汇总了PHP中Magento\Backend\Model\Auth\Session::isAllowed方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::isAllowed方法的具体用法?PHP Session::isAllowed怎么用?PHP Session::isAllowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Model\Auth\Session
的用法示例。
在下文中一共展示了Session::isAllowed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAllowed
/**
* {@inheritdoc}
*/
public function isAllowed($resource, $privilege = null)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'isAllowed');
if (!$pluginInfo) {
return parent::isAllowed($resource, $privilege);
} else {
return $this->___callPlugins('isAllowed', func_get_args(), $pluginInfo);
}
}
示例2: testIsAllowed
/**
* @dataProvider isAllowedDataProvider
* @param bool $isUserDefined
* @param bool $isAclDefined
* @param bool $isAllowed
* @param true $expectedResult
*/
public function testIsAllowed($isUserDefined, $isAclDefined, $isAllowed, $expectedResult)
{
$userAclRole = 'userAclRole';
if ($isAclDefined) {
$aclMock = $this->getMockBuilder('Magento\\Framework\\Acl')->disableOriginalConstructor()->getMock();
$this->storage->expects($this->any())->method('getAcl')->willReturn($aclMock);
}
if ($isUserDefined) {
$userMock = $this->getMockBuilder('Magento\\User\\Model\\User')->disableOriginalConstructor()->getMock();
$this->storage->expects($this->once())->method('getUser')->willReturn($userMock);
}
if ($isAclDefined && $isUserDefined) {
$userMock->expects($this->any())->method('getAclRole')->willReturn($userAclRole);
$aclMock->expects($this->once())->method('isAllowed')->with($userAclRole)->willReturn($isAllowed);
}
$this->assertEquals($expectedResult, $this->session->isAllowed('resource'));
}
示例3: canAccessLoginAs
/**
* 'true' - if admin user has right to use 'Login As' feature.
* @return bool
*/
public static function canAccessLoginAs()
{
return filter_var($this->_modelAuthSession->isAllowed('customer/prxgt_lgas_access'), FILTER_VALIDATE_BOOLEAN);
}