Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F950728
PhameInheritBlogPolicyRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhameInheritBlogPolicyRule.php
View Options
<?php
final
class
PhameInheritBlogPolicyRule
extends
PhabricatorPolicyRule
{
public
function
getObjectPolicyKey
()
{
return
'phame.blog'
;
}
public
function
getObjectPolicyName
()
{
return
pht
(
'Same as Blog'
);
}
public
function
getPolicyExplanation
()
{
return
pht
(
'Use the same policy as the parent blog.'
);
}
public
function
getRuleDescription
()
{
return
pht
(
'inherit from blog'
);
}
public
function
getObjectPolicyIcon
()
{
return
'fa-feed'
;
}
public
function
canApplyToObject
(
PhabricatorPolicyInterface
$object
)
{
return
(
$object
instanceof
PhamePost
);
}
public
function
applyRule
(
PhabricatorUser
$viewer
,
$value
,
PhabricatorPolicyInterface
$object
)
{
// TODO: This is incorrect in the general case, but: "PolicyRule" currently
// does not know which capability it is evaluating (so we can't test for
// the correct capability); and "PhamePost" currently has immutable view
// and edit policies (so we can only arrive here when evaluating the
// interact policy).
return
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$object
->
getBlog
(),
PhabricatorPolicyCapability
::
CAN_INTERACT
);
}
public
function
getValueControlType
()
{
return
self
::
CONTROL_TYPE_NONE
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jun 17, 2:17 PM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
224276
Default Alt Text
PhameInheritBlogPolicyRule.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment