本文整理汇总了PHP中Piwik\Piwik::isUserIsSuperUserOrTheUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::isUserIsSuperUserOrTheUser方法的具体用法?PHP Piwik::isUserIsSuperUserOrTheUser怎么用?PHP Piwik::isUserIsSuperUserOrTheUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Piwik
的用法示例。
在下文中一共展示了Piwik::isUserIsSuperUserOrTheUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUserLogin
/**
* Sets the name of the user this setting will be set for.
*
* @param $userLogin
* @throws \Exception If the current user does not have permission to set the setting value
* of `$userLogin`.
*/
public function setUserLogin($userLogin)
{
if (!empty($userLogin) && !Piwik::isUserIsSuperUserOrTheUser($userLogin)) {
throw new \Exception('You do not have the permission to read the settings of a different user');
}
$this->userLogin = $userLogin;
$this->key = $this->buildUserSettingName($this->name, $userLogin);
}
示例2: getSitesIdWithAtLeastViewAccess
/**
* Returns the list of websites ID with the 'view' or 'admin' access for the current user.
* For the superUser it returns all the websites in the database.
*
* @param bool $_restrictSitesToLogin
* @return array list of websites ID
*/
public function getSitesIdWithAtLeastViewAccess($_restrictSitesToLogin = false)
{
if (Piwik::isUserIsSuperUser() && !TaskScheduler::isTaskBeingExecuted()) {
return Access::getInstance()->getSitesIdWithAtLeastViewAccess();
}
if (!empty($_restrictSitesToLogin) && (Piwik::isUserIsSuperUserOrTheUser($_restrictSitesToLogin) || TaskScheduler::isTaskBeingExecuted())) {
$accessRaw = Access::getInstance()->getRawSitesWithSomeViewAccess($_restrictSitesToLogin);
$sitesId = array();
foreach ($accessRaw as $access) {
$sitesId[] = $access['idsite'];
}
return $sitesId;
} else {
return Access::getInstance()->getSitesIdWithAtLeastViewAccess();
}
}