Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93166788
PhabricatorTokenGiven.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, Nov 26, 17:35
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Nov 28, 17:35 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
22585043
Attached To
rPH Phabricator
PhabricatorTokenGiven.php
View Options
<?php
final
class
PhabricatorTokenGiven
extends
PhabricatorTokenDAO
implements
PhabricatorPolicyInterface
{
protected
$authorPHID
;
protected
$objectPHID
;
protected
$tokenPHID
;
private
$object
;
public
function
attachObject
(
PhabricatorTokenReceiverInterface
$object
)
{
$this
->
object
=
$object
;
return
$this
;
}
public
function
getObject
()
{
if
(
$this
->
object
===
null
)
{
throw
new
Exception
(
"Call attachObject() before getObject()!"
);
}
return
$this
->
object
;
}
public
function
getCapabilities
()
{
return
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
);
}
public
function
getPolicy
(
$capability
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_VIEW
:
return
$this
->
getObject
()->
getPolicy
(
$capability
);
default
:
return
PhabricatorPolicies
::
POLICY_NOONE
;
}
}
public
function
hasAutomaticCapability
(
$capability
,
PhabricatorUser
$user
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_VIEW
:
return
$this
->
getObject
()->
hasAutomaticCapability
(
$capability
,
$user
);
default
:
if
(
$user
->
getPHID
()
==
$this
->
authorPHID
)
{
return
true
;
}
return
false
;
}
}
}
Event Timeline
Log In to Comment