[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/oauthserver/controller/client/ -> PhabricatorOAuthClientDeleteController.php (source)

   1  <?php
   2  
   3  final class PhabricatorOAuthClientDeleteController
   4    extends PhabricatorOAuthClientController {
   5  
   6    public function processRequest() {
   7      $request = $this->getRequest();
   8      $viewer = $request->getUser();
   9  
  10      $client = id(new PhabricatorOAuthServerClientQuery())
  11        ->setViewer($viewer)
  12        ->withPHIDs(array($this->getClientPHID()))
  13        ->requireCapabilities(
  14          array(
  15            PhabricatorPolicyCapability::CAN_VIEW,
  16            PhabricatorPolicyCapability::CAN_EDIT,
  17          ))
  18        ->executeOne();
  19      if (!$client) {
  20        return new Aphront404Response();
  21      }
  22  
  23      if ($request->isFormPost()) {
  24        $client->delete();
  25        $app_uri = $this->getApplicationURI();
  26        return id(new AphrontRedirectResponse())->setURI($app_uri);
  27      }
  28  
  29      $dialog = id(new AphrontDialogView())
  30        ->setUser($viewer)
  31        ->setTitle(pht('Delete OAuth Application?'))
  32        ->appendParagraph(
  33          pht(
  34            'Really delete the OAuth application %s?',
  35            phutil_tag('strong', array(), $client->getName())))
  36        ->addCancelButton($client->getViewURI())
  37        ->addSubmitButton(pht('Delete Application'));
  38  
  39      return id(new AphrontDialogResponse())->setDialog($dialog);
  40    }
  41  
  42  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1