Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F436270
PhabricatorPolicyRuleUsers.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorPolicyRuleUsers.php
View Options
<?php
final
class
PhabricatorPolicyRuleUsers
extends
PhabricatorPolicyRule
{
public
function
getRuleDescription
()
{
return
pht
(
'users'
);
}
public
function
applyRule
(
PhabricatorUser
$viewer
,
$value
)
{
foreach
(
$value
as
$phid
)
{
if
(
$phid
==
$viewer
->
getPHID
())
{
return
true
;
}
}
return
false
;
}
public
function
getValueControlType
()
{
return
self
::
CONTROL_TYPE_TOKENIZER
;
}
public
function
getValueControlTemplate
()
{
return
array
(
'markup'
=>
new
AphrontTokenizerTemplateView
(),
'uri'
=>
'/typeahead/common/accounts/'
,
'placeholder'
=>
pht
(
'Type a user name...'
),
);
}
public
function
getRuleOrder
()
{
return
100
;
}
public
function
getValueForStorage
(
$value
)
{
PhutilTypeSpec
::
newFromString
(
'list<string>'
)->
check
(
$value
);
return
array_values
(
$value
);
}
public
function
getValueForDisplay
(
PhabricatorUser
$viewer
,
$value
)
{
if
(!
$value
)
{
return
array
();
}
$handles
=
id
(
new
PhabricatorHandleQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
$value
)
->
execute
();
return
mpull
(
$handles
,
'getFullName'
,
'getPHID'
);
}
public
function
ruleHasEffect
(
$value
)
{
return
(
bool
)
$value
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 3, 10:45 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
61644
Default Alt Text
PhabricatorPolicyRuleUsers.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment