Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1471262
PhabricatorOAuthClientDisableController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorOAuthClientDisableController.php
View Options
<?php
final
class
PhabricatorOAuthClientDisableController
extends
PhabricatorOAuthClientController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
$client
=
id
(
new
PhabricatorOAuthServerClientQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$request
->
getURIData
(
'id'
)))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$client
)
{
return
new
Aphront404Response
();
}
$done_uri
=
$client
->
getViewURI
();
$is_disable
=
!
$client
->
getIsDisabled
();
if
(
$request
->
isFormPost
())
{
$xactions
=
array
();
$xactions
[]
=
id
(
new
PhabricatorOAuthServerTransaction
())
->
setTransactionType
(
PhabricatorOAuthServerTransaction
::
TYPE_DISABLED
)
->
setNewValue
((
int
)
$is_disable
);
$editor
=
id
(
new
PhabricatorOAuthServerEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
applyTransactions
(
$client
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$done_uri
);
}
if
(
$is_disable
)
{
$title
=
pht
(
'Disable OAuth Application'
);
$body
=
pht
(
'Really disable the %s OAuth application? Users will no longer be '
.
'able to authenticate against it, nor access this server using '
.
'tokens generated by this application.'
,
phutil_tag
(
'strong'
,
array
(),
$client
->
getName
()));
$button
=
pht
(
'Disable Application'
);
}
else
{
$title
=
pht
(
'Enable OAuth Application'
);
$body
=
pht
(
'Really enable the %s OAuth application? Users will be able to '
.
'authenticate against it, and existing tokens will become usable '
.
'again.'
,
phutil_tag
(
'strong'
,
array
(),
$client
->
getName
()));
$button
=
pht
(
'Enable Application'
);
}
return
$this
->
newDialog
()
->
setTitle
(
$title
)
->
appendParagraph
(
$body
)
->
addCancelButton
(
$done_uri
)
->
addSubmitButton
(
$button
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Jul 12, 7:45 AM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
344181
Default Alt Text
PhabricatorOAuthClientDisableController.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment