X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=thumb.php;h=13dbc0e767ca3742e3d8d68e288b165abb95edbc;hb=31c334794c8164e44353e22aed71bb27caca80e3;hp=cf9bd2cdfeae0010ea89bb2e6baa59036dacff6e;hpb=6f7c4dd5dc8929a6d3cb3e96d29729b4582c1721;p=lhc%2Fweb%2Fwiklou.git diff --git a/thumb.php b/thumb.php index cf9bd2cdfe..13dbc0e767 100644 --- a/thumb.php +++ b/thumb.php @@ -91,6 +91,7 @@ function wfThumbHandle404() { */ function wfStreamThumb( array $params ) { global $wgVaryOnXFP; + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); $headers = []; // HTTP headers to send @@ -154,8 +155,11 @@ function wfStreamThumb( array $params ) { // Check permissions if there are read restrictions $varyHeader = []; - if ( !in_array( 'read', User::getGroupPermissions( [ '*' ] ), true ) ) { - if ( !$img->getTitle() || !$img->getTitle()->userCan( 'read' ) ) { + if ( !in_array( 'read', $permissionManager->getGroupPermissions( [ '*' ] ), true ) ) { + $user = RequestContext::getMain()->getUser(); + $imgTitle = $img->getTitle(); + + if ( !$imgTitle || !$permissionManager->userCan( 'read', $user, $imgTitle ) ) { wfThumbError( 403, 'Access denied. You do not have permission to access ' . 'the source file.' ); return;