Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92698799
PhabricatorUsersPolicyRule.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
Fri, Nov 22, 21:45
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 21:45 (1 d, 19 h)
Engine
blob
Format
Raw Data
Handle
22489255
Attached To
rPH Phabricator
PhabricatorUsersPolicyRule.php
View Options
<?php
final
class
PhabricatorUsersPolicyRule
extends
PhabricatorPolicyRule
{
public
function
getRuleDescription
()
{
return
pht
(
'users'
);
}
public
function
applyRule
(
PhabricatorUser
$viewer
,
$value
,
PhabricatorPolicyInterface
$object
)
{
foreach
(
$value
as
$phid
)
{
if
(
$phid
==
$viewer
->
getPHID
())
{
return
true
;
}
}
return
false
;
}
public
function
getValueControlType
()
{
return
self
::
CONTROL_TYPE_TOKENIZER
;
}
public
function
getValueControlTemplate
()
{
return
$this
->
getDatasourceTemplate
(
new
PhabricatorPeopleDatasource
());
}
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
;
}
}
Event Timeline
Log In to Comment