1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-07 12:28:28 +01:00

Make "user role" editing more clear

Summary: The various interfaces here are in conflict about what a role is and isn't. Make them all consistent.

Test Plan: Edited some users into various roles, verified they reported correctly.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1190

Differential Revision: https://secure.phabricator.com/D2415
This commit is contained in:
epriestley 2012-05-07 10:25:36 -07:00
parent 2d9d2f1aed
commit 803dea1517
2 changed files with 37 additions and 9 deletions

View file

@ -47,7 +47,7 @@ final class PhabricatorPeopleEditController
$views = array( $views = array(
'basic' => 'Basic Information', 'basic' => 'Basic Information',
'role' => 'Edit Role', 'role' => 'Edit Roles',
'cert' => 'Conduit Certificate', 'cert' => 'Conduit Certificate',
); );
@ -269,13 +269,28 @@ final class PhabricatorPeopleEditController
'Send "Welcome to Phabricator" email.', 'Send "Welcome to Phabricator" email.',
$welcome_checked)); $welcome_checked));
} else { } else {
$roles = array();
if ($user->getIsSystemAgent()) {
$roles[] = 'System Agent';
}
if ($user->getIsAdmin()) {
$roles[] = 'Admin';
}
if ($user->getIsDisabled()) {
$roles[] = 'Disabled';
}
if (!$roles) {
$roles[] = 'Normal User';
}
$roles = implode(', ', $roles);
$form->appendChild( $form->appendChild(
id(new AphrontFormStaticControl()) id(new AphrontFormStaticControl())
->setLabel('Role') ->setLabel('Roles')
->setValue( ->setValue($roles));
$user->getIsSystemAgent()
? 'System Agent'
: 'Normal User'));
} }
$form $form
@ -374,7 +389,7 @@ final class PhabricatorPeopleEditController
->addCheckbox( ->addCheckbox(
'is_admin', 'is_admin',
1, 1,
'Admin: wields absolute power.', 'Administrator',
$user->getIsAdmin()) $user->getIsAdmin())
->setDisabled($is_self)) ->setDisabled($is_self))
->appendChild( ->appendChild(
@ -382,9 +397,17 @@ final class PhabricatorPeopleEditController
->addCheckbox( ->addCheckbox(
'is_disabled', 'is_disabled',
1, 1,
'Disabled: can not login.', 'Disabled',
$user->getIsDisabled()) $user->getIsDisabled())
->setDisabled($is_self)); ->setDisabled($is_self))
->appendChild(
id(new AphrontFormCheckboxControl())
->addCheckbox(
'is_agent',
1,
'System Agent (Bot/Script User)',
$user->getIsSystemAgent())
->setDisabled(true));
if (!$is_self) { if (!$is_self) {
$form $form

View file

@ -44,6 +44,11 @@ for them. System agents:
- **can not review diffs or own tasks**; - **can not review diffs or own tasks**;
- **do not appear in CC tokenzers**. - **do not appear in CC tokenzers**.
Currently, the **System Agent** role for an account can not be changed after the
account is created. This prevents administrators form changing a normal user
into a system agent, retrieving their Conduit certificate, and then changing
them back (which would allow administrators to gain other users' credentials).
= Disabled Users = = Disabled Users =
**Disabled Users** are accounts that are no longer active. Generally, when **Disabled Users** are accounts that are no longer active. Generally, when