deleteUserOnly() public méthode

public deleteUserOnly ( $userLogin )
Exemple #1
0
 /**
  * Delete a user and all its access, given its login.
  *
  * @param string $userLogin the user login.
  *
  * @throws Exception if the user doesn't exist
  *
  * @return bool true on success
  */
 public function deleteUser($userLogin)
 {
     Piwik::checkUserHasSuperUserAccess();
     $this->checkUserIsNotAnonymous($userLogin);
     if (!$this->userExists($userLogin)) {
         throw new Exception(Piwik::translate("UsersManager_ExceptionDeleteDoesNotExist", $userLogin));
     }
     if ($this->isUserTheOnlyUserHavingSuperUserAccess($userLogin)) {
         $message = Piwik::translate("UsersManager_ExceptionDeleteOnlyUserWithSuperUserAccess", $userLogin) . " " . Piwik::translate("UsersManager_ExceptionYouMustGrantSuperUserAccessFirst");
         throw new Exception($message);
     }
     $this->model->deleteUserOnly($userLogin);
     $this->model->deleteUserAccess($userLogin);
     Cache::deleteTrackerCache();
 }