Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95803250
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
Thu, Dec 19, 10:14
Size
929 B
Mime Type
text/x-php
Expires
Sat, Dec 21, 10:14 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
23057147
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
=
$request
->
newContentSource
();
$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