Path: blob/master/src/applications/people/controller/PhabricatorPeopleApproveController.php
12256 views
<?php12final class PhabricatorPeopleApproveController3extends PhabricatorPeopleController {45public function handleRequest(AphrontRequest $request) {6$viewer = $request->getViewer();78$user = id(new PhabricatorPeopleQuery())9->setViewer($viewer)10->withIDs(array($request->getURIData('id')))11->executeOne();12if (!$user) {13return new Aphront404Response();14}1516$via = $request->getURIData('via');17switch ($via) {18case 'profile':19$done_uri = urisprintf('/people/manage/%d/', $user->getID());20break;21default:22$done_uri = $this->getApplicationURI('query/approval/');23break;24}2526if ($user->getIsApproved()) {27return $this->newDialog()28->setTitle(pht('Already Approved'))29->appendChild(pht('This user has already been approved.'))30->addCancelButton($done_uri);31}3233if ($request->isFormPost()) {34$xactions = array();3536$xactions[] = id(new PhabricatorUserTransaction())37->setTransactionType(PhabricatorUserApproveTransaction::TRANSACTIONTYPE)38->setNewValue(true);3940id(new PhabricatorUserTransactionEditor())41->setActor($viewer)42->setContentSourceFromRequest($request)43->setContinueOnMissingFields(true)44->setContinueOnNoEffect(true)45->applyTransactions($user, $xactions);4647return id(new AphrontRedirectResponse())->setURI($done_uri);48}4950return $this->newDialog()51->setTitle(pht('Confirm Approval'))52->appendChild(53pht(54'Allow %s to access this server?',55phutil_tag('strong', array(), $user->getUsername())))56->addCancelButton($done_uri)57->addSubmitButton(pht('Approve Account'));58}59}606162