Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99301767
DrydockCommand.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
Thu, Jan 23, 06:23
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jan 25, 06:23 (2 d)
Engine
blob
Format
Raw Data
Handle
23771938
Attached To
rPH Phabricator
DrydockCommand.php
View Options
<?php
final
class
DrydockCommand
extends
DrydockDAO
implements
PhabricatorPolicyInterface
{
const
COMMAND_RELEASE
=
'release'
;
const
COMMAND_RECLAIM
=
'reclaim'
;
protected
$authorPHID
;
protected
$targetPHID
;
protected
$command
;
protected
$isConsumed
;
private
$commandTarget
=
self
::
ATTACHABLE
;
public
static
function
initializeNewCommand
(
PhabricatorUser
$author
)
{
return
id
(
new
DrydockCommand
())
->
setAuthorPHID
(
$author
->
getPHID
())
->
setIsConsumed
(
0
);
}
protected
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'command'
=>
'text32'
,
'isConsumed'
=>
'bool'
,
),
self
::
CONFIG_KEY_SCHEMA
=>
array
(
'key_target'
=>
array
(
'columns'
=>
array
(
'targetPHID'
,
'isConsumed'
),
),
),
)
+
parent
::
getConfiguration
();
}
public
function
attachCommandTarget
(
$target
)
{
$this
->
commandTarget
=
$target
;
return
$this
;
}
public
function
getCommandTarget
()
{
return
$this
->
assertAttached
(
$this
->
commandTarget
);
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */
public
function
getCapabilities
()
{
return
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
);
}
public
function
getPolicy
(
$capability
)
{
return
$this
->
getCommandTarget
()->
getPolicy
(
$capability
);
}
public
function
hasAutomaticCapability
(
$capability
,
PhabricatorUser
$viewer
)
{
return
$this
->
getCommandTarget
()->
hasAutomaticCapability
(
$capability
,
$viewer
);
}
public
function
describeAutomaticCapability
(
$capability
)
{
return
pht
(
'Drydock commands have the same policies as their targets.'
);
}
}
Event Timeline
Log In to Comment