Exemplo n.º 1
0
 private function actionRemoveSSHKey(Git_RemoteServer_GerritServer $server, Git_Driver_Gerrit_User $user, $gerrit_key_id)
 {
     try {
         $this->sendRequest($server, $this->guzzle_client->delete($this->getGerritURL($server, '/accounts/' . urlencode($user->getSSHUserName()) . '/sshkeys/' . urlencode($gerrit_key_id)), $this->getRequestOptions()));
         $this->logger->info("Gerrit REST driver: Successfully deleted ssh key ({$gerrit_key_id})");
         return true;
     } catch (Exception $exception) {
         $this->throwGerritException("Gerrit REST driver: Cannot remove ssh key ({$gerrit_key_id}): " . $exception->getMessage());
     }
 }
Exemplo n.º 2
0
 /**
  * @param Git_RemoteServer_GerritServer $server
  * @param PFUser $user
  *
  * @return Guzzle\Http\Message\Response
  */
 public function setUserAccountInactive(Git_RemoteServer_GerritServer $server, PFUser $user)
 {
     try {
         $this->sendRequest($server, $this->guzzle_client->delete($this->getGerritURL($server, '/accounts/' . urlencode($user->getUserName()) . '/active'), $this->getRequestOptions()));
         $this->logger->info($GLOBALS['Language']->getText('plugin_git', 'gerrit_user_suspension_successful', array($user->getId(), $user->getUserName(), $server)));
         return true;
     } catch (Exception $exception) {
         $this->logger->error($GLOBALS['Language']->getText('plugin_git', 'gerrit_user_suspension_error', array($user->getId(), $user->getUserName(), $server, $exception->getMessage())));
     }
 }