Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F111996973
PhabricatorPeopleApproveController.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, May 6, 14:33
Size
1 KB
Mime Type
text/x-php
Expires
Thu, May 8, 14:33 (1 d, 20 h)
Engine
blob
Format
Raw Data
Handle
25985617
Attached To
rPH Phabricator
PhabricatorPeopleApproveController.php
View Options
<?php
final
class
PhabricatorPeopleApproveController
extends
PhabricatorPeopleController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$user
=
id
(
new
PhabricatorPeopleQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$request
->
getURIData
(
'id'
)))
->
executeOne
();
if
(!
$user
)
{
return
new
Aphront404Response
();
}
$via
=
$request
->
getURIData
(
'via'
);
switch
(
$via
)
{
case
'profile'
:
$done_uri
=
urisprintf
(
'/people/manage/%d/'
,
$user
->
getID
());
break
;
default
:
$done_uri
=
$this
->
getApplicationURI
(
'query/approval/'
);
break
;
}
if
(
$user
->
getIsApproved
())
{
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Already Approved'
))
->
appendChild
(
pht
(
'This user has already been approved.'
))
->
addCancelButton
(
$done_uri
);
}
if
(
$user
->
getIsApproved
())
{
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Already Approved'
))
->
appendChild
(
pht
(
'This user has already been approved.'
))
->
addCancelButton
(
$done_uri
);
}
if
(
$request
->
isFormPost
())
{
$xactions
=
array
();
$xactions
[]
=
id
(
new
PhabricatorUserTransaction
())
->
setTransactionType
(
PhabricatorUserApproveTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
true
);
id
(
new
PhabricatorUserTransactionEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnMissingFields
(
true
)
->
setContinueOnNoEffect
(
true
)
->
applyTransactions
(
$user
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$done_uri
);
}
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Confirm Approval'
))
->
appendChild
(
pht
(
'Allow %s to access this Phabricator install?'
,
phutil_tag
(
'strong'
,
array
(),
$user
->
getUsername
())))
->
addCancelButton
(
$done_uri
)
->
addSubmitButton
(
pht
(
'Approve Account'
));
}
}
Event Timeline
Log In to Comment