[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorPeopleEmpowerController 4 extends PhabricatorPeopleController { 5 6 private $id; 7 8 public function willProcessRequest(array $data) { 9 $this->id = $data['id']; 10 } 11 12 public function processRequest() { 13 $request = $this->getRequest(); 14 $admin = $request->getUser(); 15 16 $user = id(new PhabricatorPeopleQuery()) 17 ->setViewer($admin) 18 ->withIDs(array($this->id)) 19 ->executeOne(); 20 if (!$user) { 21 return new Aphront404Response(); 22 } 23 24 $profile_uri = '/p/'.$user->getUsername().'/'; 25 26 id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession( 27 $admin, 28 $request, 29 $profile_uri); 30 31 if ($user->getPHID() == $admin->getPHID()) { 32 return $this->newDialog() 33 ->setTitle(pht('Your Way is Blocked')) 34 ->appendParagraph( 35 pht( 36 'After a time, your efforts fail. You can not adjust your own '. 37 'status as an administrator.')) 38 ->addCancelButton($profile_uri, pht('Accept Fate')); 39 } 40 41 if ($request->isFormPost()) { 42 id(new PhabricatorUserEditor()) 43 ->setActor($admin) 44 ->makeAdminUser($user, !$user->getIsAdmin()); 45 46 return id(new AphrontRedirectResponse())->setURI($profile_uri); 47 } 48 49 if ($user->getIsAdmin()) { 50 $title = pht('Remove as Administrator?'); 51 $short = pht('Remove Administrator'); 52 $body = pht( 53 'Remove %s as an administrator? They will no longer be able to '. 54 'perform administrative functions on this Phabricator install.', 55 phutil_tag('strong', array(), $user->getUsername())); 56 $submit = pht('Remove Administrator'); 57 } else { 58 $title = pht('Make Administrator?'); 59 $short = pht('Make Administrator'); 60 $body = pht( 61 'Empower %s as an admistrator? They will be able to create users, '. 62 'approve users, make and remove administrators, delete accounts, and '. 63 'perform other administrative functions on this Phabricator install.', 64 phutil_tag('strong', array(), $user->getUsername())); 65 $submit = pht('Make Administrator'); 66 } 67 68 return $this->newDialog() 69 ->setTitle($title) 70 ->setShortTitle($short) 71 ->appendParagraph($body) 72 ->addCancelButton($profile_uri) 73 ->addSubmitButton($submit); 74 } 75 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |