Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101534365
DrydockBlueprint.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
Tue, Feb 11, 08:38
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Feb 13, 08:38 (2 d)
Engine
blob
Format
Raw Data
Handle
24178534
Attached To
rPH Phabricator
DrydockBlueprint.php
View Options
<?php
final
class
DrydockBlueprint
extends
DrydockDAO
implements
PhabricatorPolicyInterface
{
protected
$phid
;
protected
$className
;
protected
$viewPolicy
;
protected
$editPolicy
;
protected
$details
;
public
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_AUX_PHID
=>
true
,
self
::
CONFIG_SERIALIZATION
=>
array
(
'details'
=>
self
::
SERIALIZATION_JSON
,
)
)
+
parent
::
getConfiguration
();
}
public
function
generatePHID
()
{
return
PhabricatorPHID
::
generateNewPHID
(
DrydockPHIDTypeBlueprint
::
TYPECONST
);
}
public
function
getImplementation
()
{
$class
=
$this
->
className
;
$implementations
=
DrydockBlueprintImplementation
::
getAllBlueprintImplementations
();
if
(!
isset
(
$implementations
[
$class
]))
{
throw
new
Exception
(
"Invalid class name for blueprint (got '"
.
$class
.
"')"
);
}
return
id
(
new
$class
())->
attachInstance
(
$this
);
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */
public
function
getCapabilities
()
{
return
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
);
}
public
function
getPolicy
(
$capability
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_VIEW
:
return
$this
->
getViewPolicy
();
case
PhabricatorPolicyCapability
::
CAN_EDIT
:
return
$this
->
getEditPolicy
();
}
}
public
function
hasAutomaticCapability
(
$capability
,
PhabricatorUser
$viewer
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_VIEW
:
case
PhabricatorPolicyCapability
::
CAN_EDIT
:
return
$viewer
->
getIsAdmin
();
}
}
public
function
describeAutomaticCapability
(
$capability
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_VIEW
:
return
pht
(
'Administrators can always view blueprints.'
);
case
PhabricatorPolicyCapability
::
CAN_EDIT
:
return
pht
(
'Administrators can always edit blueprints.'
);
}
}
}
Event Timeline
Log In to Comment