Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122177242
DifferentialEditPolicyFieldSpecification.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
Wed, Jul 16, 09:06
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jul 18, 09:06 (2 d)
Engine
blob
Format
Raw Data
Handle
27445054
Attached To
rPH Phabricator
DifferentialEditPolicyFieldSpecification.php
View Options
<?php
final
class
DifferentialEditPolicyFieldSpecification
extends
DifferentialFieldSpecification
{
private
$value
;
public
function
shouldAppearOnEdit
()
{
return
true
;
}
protected
function
didSetRevision
()
{
$this
->
value
=
$this
->
getRevision
()->
getEditPolicy
();
}
public
function
setValueFromRequest
(
AphrontRequest
$request
)
{
$this
->
value
=
$request
->
getStr
(
'editPolicy'
);
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_EDIT
)
->
setPolicyObject
(
$revision
)
->
setPolicies
(
$policies
)
->
setName
(
'editPolicy'
)
->
setCaption
(
pht
(
'NOTE: These policy features are not yet fully supported.'
));
}
public
function
willWriteRevision
(
DifferentialRevisionEditor
$editor
)
{
$this
->
getRevision
()->
setEditPolicy
(
$this
->
value
);
}
}
Event Timeline
Log In to Comment