[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/people/controller/ -> PhabricatorPeopleCreateController.php (source)

   1  <?php
   2  
   3  final class PhabricatorPeopleCreateController
   4    extends PhabricatorPeopleController {
   5  
   6    public function processRequest() {
   7      $request = $this->getRequest();
   8      $admin = $request->getUser();
   9  
  10      id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
  11        $admin,
  12        $request,
  13        $this->getApplicationURI());
  14  
  15      $v_type = 'standard';
  16      if ($request->isFormPost()) {
  17        $v_type = $request->getStr('type');
  18  
  19        if ($v_type == 'standard' || $v_type == 'bot') {
  20          return id(new AphrontRedirectResponse())->setURI(
  21            $this->getApplicationURI('new/'.$v_type.'/'));
  22        }
  23      }
  24  
  25      $title = pht('Create New User');
  26  
  27      $standard_caption = pht(
  28        'Create a standard user account. These users can log in to Phabricator, '.
  29        'use the web interface and API, and receive email.');
  30  
  31      $standard_admin = pht(
  32        'Administrators are limited in their ability to access or edit these '.
  33        'accounts after account creation.');
  34  
  35      $bot_caption = pht(
  36        'Create a bot/script user account, to automate interactions with other '.
  37        'systems. These users can not use the web interface, but can use the '.
  38        'API.');
  39  
  40      $bot_admin = pht(
  41        'Administrators have greater access to edit these accounts.');
  42  
  43      $form = id(new AphrontFormView())
  44        ->setUser($admin)
  45        ->appendRemarkupInstructions(
  46          pht(
  47            'Choose the type of user account to create. For a detailed '.
  48            'explanation of user account types, see [[ %s | User Guide: '.
  49            'Account Roles ]].',
  50            PhabricatorEnv::getDoclink('User Guide: Account Roles')))
  51        ->appendChild(
  52          id(new AphrontFormRadioButtonControl())
  53            ->setLabel(pht('Account Type'))
  54            ->setName('type')
  55            ->setValue($v_type)
  56            ->addButton(
  57              'standard',
  58              pht('Create Standard User'),
  59              hsprintf('%s<br /><br />%s', $standard_caption, $standard_admin))
  60            ->addButton(
  61              'bot',
  62              pht('Create Bot/Script User'),
  63              hsprintf('%s<br /><br />%s', $bot_caption, $bot_admin)))
  64        ->appendChild(
  65          id(new AphrontFormSubmitControl())
  66            ->addCancelButton($this->getApplicationURI())
  67            ->setValue(pht('Continue')));
  68  
  69      $crumbs = $this->buildApplicationCrumbs();
  70      $crumbs->addTextCrumb($title);
  71  
  72      $box = id(new PHUIObjectBoxView())
  73        ->setHeaderText($title)
  74        ->appendChild($form);
  75  
  76      return $this->buildApplicationPage(
  77        array(
  78          $crumbs,
  79          $box,
  80        ),
  81        array(
  82          'title' => $title,
  83        ));
  84    }
  85  
  86  }


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