From f6e1891c6f36a4fb4248512e1a21d65bb56138cf Mon Sep 17 00:00:00 2001 From: Cindy Cicalese Date: Mon, 11 Jan 2021 10:26:02 -0500 Subject: Use Authority and GroupPermissionLookup in Action API Replaces calls directly to PermissionManager with calls to the Authority object available from Context or the GroupPermissionLookup service. This patch does not address use of PermissionManager for blocks. Deprecations: - ApiBase::checkUserRightsAny deprecated passing optional User parameter - ApiBase::checkTitleUserPermissions deprecated passing LinkTarget as first parameter, takes PageIdentity instead Bug: T271462 Bug: T271854 Change-Id: I5d7cac1c28a37e074750c46cda03283980a07fca --- includes/api/ApiQueryFilearchive.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'includes/api/ApiQueryFilearchive.php') diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index 5742c0860be5..2e3f6cc26bce 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -57,14 +57,10 @@ class ApiQueryFilearchive extends ApiQueryBase { $fld_bitdepth = isset( $prop['bitdepth'] ); $fld_archivename = isset( $prop['archivename'] ); - if ( $fld_description && - !$this->getPermissionManager()->userHasRight( $user, 'deletedhistory' ) - ) { + if ( $fld_description && !$this->getAuthority()->isAllowed( 'deletedhistory' ) ) { $this->dieWithError( 'apierror-cantview-deleted-description', 'permissiondenied' ); } - if ( $fld_metadata && - !$this->getPermissionManager()->userHasAnyRight( $user, 'deletedtext', 'undelete' ) - ) { + if ( $fld_metadata && !$this->getAuthority()->isAllowedAny( 'deletedtext', 'undelete' ) ) { $this->dieWithError( 'apierror-cantview-deleted-metadata', 'permissiondenied' ); } @@ -119,11 +115,9 @@ class ApiQueryFilearchive extends ApiQueryBase { if ( $sha1 ) { $this->addWhereFld( 'fa_sha1', $sha1 ); // Paranoia: avoid brute force searches (T19342) - if ( !$this->getPermissionManager()->userHasRight( $user, 'deletedtext' ) ) { + if ( !$this->getAuthority()->isAllowed( 'deletedtext' ) ) { $bitmask = File::DELETED_FILE; - } elseif ( !$this->getPermissionManager() - ->userHasAnyRight( $user, 'suppressrevision', 'viewsuppressed' ) - ) { + } elseif ( !$this->getAuthority()->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) { $bitmask = File::DELETED_FILE | File::DELETED_RESTRICTED; } else { $bitmask = 0; -- cgit v1.2.3