Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80161422
DifferentialEditPolicyField.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, Aug 30, 05:21
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Sep 1, 05:21 (2 d)
Engine
blob
Format
Raw Data
Handle
20313082
Attached To
rPH Phabricator
DifferentialEditPolicyField.php
View Options
<?php
final
class
DifferentialEditPolicyField
extends
DifferentialCoreCustomField
{
public
function
getFieldKey
()
{
return
'differential:edit-policy'
;
}
public
function
getFieldName
()
{
return
pht
(
'Edit Policy'
);
}
public
function
getFieldDescription
()
{
return
pht
(
'Controls who can edit a revision.'
);
}
protected
function
readValueFromRevision
(
DifferentialRevision
$revision
)
{
return
$revision
->
getEditPolicy
();
}
public
function
readValueFromRequest
(
AphrontRequest
$request
)
{
$this
->
setValue
(
$request
->
getStr
(
$this
->
getFieldKey
()));
}
public
function
renderEditControl
(
array
$handles
)
{
$viewer
=
$this
->
getViewer
();
$revision
=
$this
->
getObject
();
$policies
=
id
(
new
PhabricatorPolicyQuery
())
->
setViewer
(
$viewer
)
->
setObject
(
$revision
)
->
execute
();
return
id
(
new
AphrontFormPolicyControl
())
->
setUser
(
$viewer
)
->
setCapability
(
PhabricatorPolicyCapability
::
CAN_EDIT
)
->
setPolicyObject
(
$revision
)
->
setPolicies
(
$policies
)
->
setName
(
$this
->
getFieldKey
())
->
setValue
(
$this
->
getValue
())
->
setError
(
$this
->
getFieldError
());
}
public
function
getApplicationTransactionType
()
{
return
PhabricatorTransactions
::
TYPE_EDIT_POLICY
;
}
}
Event Timeline
Log In to Comment