1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-27 05:59:08 +01:00
phorge-phorge/src/applications/people/customfield/PhabricatorUserRolesField.php

46 lines
828 B
PHP
Raw Normal View History

<?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;
}
}