本文整理汇总了PHP中Piwik\Access::hasSuperUserAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Access::hasSuperUserAccess方法的具体用法?PHP Access::hasSuperUserAccess怎么用?PHP Access::hasSuperUserAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Access
的用法示例。
在下文中一共展示了Access::hasSuperUserAccess方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_process_shouldKeepSuperUserPermission_IfAccessWasManuallySet
public function test_process_shouldKeepSuperUserPermission_IfAccessWasManuallySet()
{
$this->access->setSuperUserAccess(true);
$this->assertAccessReloadedAndRestored('difFenrenT');
$request = new Request(array('method' => 'API.getPiwikVersion', 'token_auth' => 'difFenrenT'));
$request->process();
// make sure token auth was restored after it was loaded with difFenrenT
$this->assertSameUserAsBeforeIsAuthenticated();
$this->assertTrue($this->access->hasSuperUserAccess());
}
示例2: filterLogins
/**
* Removes all logins from the list of logins where the current user has no permission to see them.
*
* @param string[] $logins An array of logins / usernames. Eg array('username1', 'username2')
* @return array
*/
public function filterLogins($logins)
{
if ($this->access->hasSuperUserAccess()) {
return $logins;
}
if (!$this->access->isUserHasSomeAdminAccess()) {
// keep only own user if it is in the list
foreach ($logins as $login) {
if ($this->isOwnLogin($login)) {
return array($login);
}
}
return array();
}
foreach ($logins as $index => $login) {
if (!$this->isNonSuperUserAllowedToSeeThisLogin($login)) {
unset($logins[$index]);
}
}
return array_values($logins);
}
示例3: testHasSuperUserAccessWithEmptyAccess
public function testHasSuperUserAccessWithEmptyAccess()
{
$access = new Access();
$this->assertFalse($access->hasSuperUserAccess());
}
示例4: testReloadAccessWithMockedAuthValid
public function testReloadAccessWithMockedAuthValid()
{
$mock = $this->createPiwikAuthMockInstance();
$mock->expects($this->once())->method('authenticate')->will($this->returnValue(new AuthResult(AuthResult::SUCCESS, 'login', 'token')));
$mock->expects($this->any())->method('getName')->will($this->returnValue("test name"));
$access = new Access();
$this->assertTrue($access->reloadAccess($mock));
$this->assertFalse($access->hasSuperUserAccess());
}