From e693b7c405d5be445297e53e7e22ba483fb6602e Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Tue, 4 May 2010 14:48:56 +0000 Subject: [PATCH] Fix for r65818: the proper permission is 'createpage', not 'create'. Skip checking 'createpage' in isAllowed, because a user could have permission to reupload but not to upload. --- includes/upload/UploadBase.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 3a6fd2e2a2..d8a49a623c 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -83,7 +83,7 @@ abstract class UploadBase { * @return array */ public static function getRequiredPermissions() { - return array( 'upload', 'create', 'edit' ); + return array( 'upload', 'edit' ); } /** * Returns true if the user can use this upload module or else a string @@ -396,7 +396,11 @@ abstract class UploadBase { } $permErrors = $nt->getUserPermissionsErrors( 'edit', $user ); $permErrorsUpload = $nt->getUserPermissionsErrors( 'upload', $user ); - $permErrorsCreate = ( $nt->exists() ? array() : $nt->getUserPermissionsErrors( 'create', $user ) ); + if ( $nt->exists() ) { + $permErrorsCreate = $nt->getUserPermissionsErrors( 'createpage', $user ); + } else { + $permErrorsCreate = array(); + } if( $permErrors || $permErrorsUpload || $permErrorsCreate ) { $permErrors = array_merge( $permErrors, wfArrayDiff2( $permErrorsUpload, $permErrors ) ); $permErrors = array_merge( $permErrors, wfArrayDiff2( $permErrorsCreate, $permErrors ) ); -- 2.20.1