Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104725006
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
Tue, Mar 11, 20:53
Size
929 B
Mime Type
text/x-php
Expires
Thu, Mar 13, 20:53 (2 d)
Engine
blob
Format
Raw Data
Handle
24837873
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