Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F110443154
TokenGiveConduitAPIMethod.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
Sat, Apr 26, 08:46
Size
958 B
Mime Type
text/x-php
Expires
Mon, Apr 28, 08:46 (2 d)
Engine
blob
Format
Raw Data
Handle
25759653
Attached To
rPH Phabricator
TokenGiveConduitAPIMethod.php
View Options
<?php
final
class
TokenGiveConduitAPIMethod
extends
TokenConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'token.give'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Give or change a token.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'tokenPHID'
=>
'phid|null'
,
'objectPHID'
=>
'phid'
,
);
}
protected
function
defineReturnType
()
{
return
'void'
;
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$content_source
=
PhabricatorContentSource
::
newFromConduitRequest
(
$request
);
$editor
=
id
(
new
PhabricatorTokenGivenEditor
())
->
setActor
(
$request
->
getUser
())
->
setContentSource
(
$content_source
);
if
(
$request
->
getValue
(
'tokenPHID'
))
{
$editor
->
addToken
(
$request
->
getValue
(
'objectPHID'
),
$request
->
getValue
(
'tokenPHID'
));
}
else
{
$editor
->
deleteToken
(
$request
->
getValue
(
'objectPHID'
));
}
}
}
Event Timeline
Log In to Comment