Skip to content

Commit

Permalink
Fix a notice when running archive.php
Browse files Browse the repository at this point in the history
  • Loading branch information
mattab committed Oct 8, 2014
1 parent 29fed0e commit 8700fe9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion plugins/UsersManager/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,12 @@ public function getUsersHavingSuperUserAccess()
{
Piwik::checkUserIsNotAnonymous();

return $this->model->getUsersHavingSuperUserAccess();
$users = $this->model->getUsersHavingSuperUserAccess();
foreach($users as &$user) {
// remove token_auth in API response
unset($user['token_auth']);
}
return $users;
}

/**
Expand Down
7 changes: 6 additions & 1 deletion plugins/UsersManager/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,14 @@ public function setSuperUserAccess($userLogin, $hasSuperUserAccess)
);
}

/**
* Note that this returns the token_auth which is as private as the password!
*
* @return returns login, email and token_auth
*/
public function getUsersHavingSuperUserAccess()
{
$users = $this->getDb()->fetchAll("SELECT login, email
$users = $this->getDb()->fetchAll("SELECT login, email, token_auth
FROM " . Common::prefixTable("user") . "
WHERE superuser_access = 1
ORDER BY date_registered ASC");
Expand Down

0 comments on commit 8700fe9

Please sign in to comment.