Skip to content

Commit

Permalink
Fix permissions check (#496)
Browse files Browse the repository at this point in the history
See comment.
  • Loading branch information
redbluegreenhat committed Mar 27, 2024
1 parent 0c95d0d commit 6bc0685
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions includes/RequestWiki/Handler/RestWikiRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,19 @@ public function run( $id ) {
);
if ( $wikiRequest ) {
$wikiRequestVisibility = $visibilityConds[$wikiRequest->cw_visibility];
if ( !$this->getAuthority()->isAllowed( $wikiRequestVisibility ) ) {
// User does not have permission to view this wiki request
return $this->getResponseFactory()->createHttpError( 404, ['message' => 'Request not found'] );

/*
* CreateWiki is enabled globally on all wikis in the farm.
*
* Require both (createwiki) and the required permission to prevent suppressed requests from
* being revealed to local suppressors/sysops
*/

if ( $wikiRequestVisibility !== 'read' ) {
if ( !$this->getAuthority()->isAllowedAll( 'createwiki', $wikiRequestVisibility ) ) {
// User does not have permission to view this request
return $this->getResponseFactory()->createHttpError( 404, ['message' => 'Request not found'] );
}
}
$response = [
'comment' => $wikiRequest->cw_comment,
Expand Down

0 comments on commit 6bc0685

Please sign in to comment.