Skip to content

Commit

Permalink
Remove checks for (read) (#497)
Browse files Browse the repository at this point in the history
Unnecessary checks, since if the user doesn't have this perm it should
not be able to reach the special pages or APIs to begin with.
  • Loading branch information
redbluegreenhat committed Mar 27, 2024
1 parent 23415c1 commit 8f8442e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion includes/RequestWiki/Handler/RestWikiRequest.php
Expand Up @@ -68,7 +68,7 @@ public function run( $id ) {
* being revealed to local suppressors/sysops
*/

if ( $wikiRequestVisibility !== 'read' && $this->getAuthority()->isAllowed( 'read' ) ) {
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'] );
Expand Down
2 changes: 1 addition & 1 deletion includes/RequestWiki/RequestWikiRequestViewer.php
Expand Up @@ -44,7 +44,7 @@ public function getFormDescriptor(
// but if we can't view the request, it also doesn't exist
$permissionManager = MediaWikiServices::getInstance()->getPermissionManager();

if ( $visibilityConds[$request->visibility] !== 'read' && $permissionManager->userHasRight( $userR, 'read' ) ) {
if ( $visibilityConds[$request->visibility] !== 'read' ) {
if ( !$permissionManager->userHasAllRights( $userR, 'createwiki', $visibilityConds[$request->visibility] ) ) {
$context->getOutput()->addHTML( Html::errorBox( wfMessage( 'requestwiki-unknown' )->escaped() ) );

Expand Down

0 comments on commit 8f8442e

Please sign in to comment.