mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 08:12:40 +01:00
When non-administrators click "Change Username", explain why they can't continue
Summary: Ref T13420. This workflow currently dead-ends for non-administrators. Instead, provide explanatory text. Test Plan: - Clicked "Change Username" as an administrator, same workflow as always. - Clicked "Change Username" as a non-administrator, got explanatory text. Maniphest Tasks: T13420 Differential Revision: https://secure.phabricator.com/D20827
This commit is contained in:
parent
058b7ae945
commit
0c331458a8
1 changed files with 15 additions and 0 deletions
|
@ -3,8 +3,13 @@
|
|||
final class PhabricatorPeopleRenameController
|
||||
extends PhabricatorPeopleController {
|
||||
|
||||
public function shouldRequireAdmin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
$user = id(new PhabricatorPeopleQuery())
|
||||
|
@ -17,6 +22,16 @@ final class PhabricatorPeopleRenameController
|
|||
|
||||
$done_uri = $this->getApplicationURI("manage/{$id}/");
|
||||
|
||||
if (!$viewer->getIsAdmin()) {
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Change Username'))
|
||||
->appendParagraph(
|
||||
pht(
|
||||
'You can not change usernames because you are not an '.
|
||||
'administrator. Only administrators can change usernames.'))
|
||||
->addCancelButton($done_uri, pht('Okay'));
|
||||
}
|
||||
|
||||
$validation_exception = null;
|
||||
$username = $user->getUsername();
|
||||
if ($request->isFormOrHisecPost()) {
|
||||
|
|
Loading…
Reference in a new issue