当前位置: 首页>>代码示例>>PHP>>正文


PHP Access::hasSuperUserAccess方法代码示例

本文整理汇总了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());
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:10,代码来源:RequestTest.php

示例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);
 }
开发者ID:JoeHorn,项目名称:piwik,代码行数:27,代码来源:UserAccessFilter.php

示例3: testHasSuperUserAccessWithEmptyAccess

 public function testHasSuperUserAccessWithEmptyAccess()
 {
     $access = new Access();
     $this->assertFalse($access->hasSuperUserAccess());
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:5,代码来源:AccessTest.php

示例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());
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:AccessTest.php


注:本文中的Piwik\Access::hasSuperUserAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。