Skip to content

Commit

Permalink
refs matomo-org#4564 also check for the config user
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Jan 22, 2014
1 parent bdb6967 commit bda7796
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/Piwik.php
Expand Up @@ -306,13 +306,21 @@ static public function checkUserIsSuperUserOrTheUser($theUser)

static public function hasTheUserSuperUserAccess($theUser)
{
if (empty($theUser)) {
return false;
}

if (Piwik::getConfigSuperUserLogin() === $theUser) {
return true;
}

try {
$superUserLogins = APIUsersManager::getInstance()->getUsersLoginHavingSuperUserAccess();
} catch (\Exception $e) {
$superUserLogins = array();
}

return !empty($theUser) && in_array($theUser, $superUserLogins);
return in_array($theUser, $superUserLogins);
}

/**
Expand Down

0 comments on commit bda7796

Please sign in to comment.