mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-27 05:59:08 +01:00
46 lines
828 B
PHP
46 lines
828 B
PHP
|
<?php
|
||
|
|
||
|
final class PhabricatorUserRolesField
|
||
|
extends PhabricatorUserCustomField {
|
||
|
|
||
|
private $value;
|
||
|
|
||
|
public function getFieldKey() {
|
||
|
return 'user:roles';
|
||
|
}
|
||
|
|
||
|
public function getFieldName() {
|
||
|
return pht('Roles');
|
||
|
}
|
||
|
|
||
|
public function getFieldDescription() {
|
||
|
return pht('Shows roles like "Administrator" and "Disabled".');
|
||
|
}
|
||
|
|
||
|
public function shouldAppearInPropertyView() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public function renderPropertyViewValue() {
|
||
|
$user = $this->getObject();
|
||
|
|
||
|
$roles = array();
|
||
|
if ($user->getIsAdmin()) {
|
||
|
$roles[] = pht('Administrator');
|
||
|
}
|
||
|
if ($user->getIsDisabled()) {
|
||
|
$roles[] = pht('Disabled');
|
||
|
}
|
||
|
if ($user->getIsSystemAgent()) {
|
||
|
$roles[] = pht('Bot');
|
||
|
}
|
||
|
|
||
|
if ($roles) {
|
||
|
return implode(', ', $roles);
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
}
|