Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99056574
PhabricatorUserRolesField.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jan 18, 18:51
Size
907 B
Mime Type
text/x-php
Expires
Mon, Jan 20, 18:51 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23698566
Attached To
rPH Phabricator
PhabricatorUserRolesField.php
View Options
<?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
->
getIsApproved
())
{
$roles
[]
=
pht
(
'Not Approved'
);
}
if
(
$user
->
getIsSystemAgent
())
{
$roles
[]
=
pht
(
'Bot'
);
}
if
(
$roles
)
{
return
implode
(
', '
,
$roles
);
}
return
null
;
}
}
Event Timeline
Log In to Comment