Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112365422
DifferentialViewPolicyFieldSpecification.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, May 10, 06:12
Size
1 KB
Mime Type
text/x-php
Expires
Mon, May 12, 06:12 (2 d)
Engine
blob
Format
Raw Data
Handle
26018179
Attached To
rPH Phabricator
DifferentialViewPolicyFieldSpecification.php
View Options
<?php
final
class
DifferentialViewPolicyFieldSpecification
extends
DifferentialFieldSpecification
{
private
$value
;
public
function
shouldAppearOnEdit
()
{
return
true
;
}
protected
function
didSetRevision
()
{
$this
->
value
=
$this
->
getRevision
()->
getViewPolicy
();
}
public
function
setValueFromRequest
(
AphrontRequest
$request
)
{
$this
->
value
=
$request
->
getStr
(
'viewPolicy'
);
return
$this
;
}
public
function
renderEditControl
()
{
$viewer
=
$this
->
getUser
();
$revision
=
$this
->
getRevision
();
$policies
=
id
(
new
PhabricatorPolicyQuery
())
->
setViewer
(
$viewer
)
->
setObject
(
$revision
)
->
execute
();
return
id
(
new
AphrontFormPolicyControl
())
->
setUser
(
$viewer
)
->
setCapability
(
PhabricatorPolicyCapability
::
CAN_VIEW
)
->
setPolicyObject
(
$revision
)
->
setPolicies
(
$policies
)
->
setName
(
'viewPolicy'
);
}
public
function
willWriteRevision
(
DifferentialRevisionEditor
$editor
)
{
$this
->
getRevision
()->
setViewPolicy
(
$this
->
value
);
}
}
Event Timeline
Log In to Comment