MarkAHershberger has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/366171 )
Change subject: ApprovedRevs only recognises per-page rights, not group rights
......................................................................
ApprovedRevs only recognises per-page rights, not group rights
When testing to see if a user has the approverevisions right, the only
check is of $title->userCan('approverevisions'). This check, though
has hooks that allow other code to alter the value returned on a
per-page basis.
Instead, $wgUser->isAllowed('approverevisions') should be used since
it is a general check on the approverevisions right.
Change-Id: I77e3c4bbe0b73b6d3992eaf41dbc6eec2ebbc82f
---
M ApprovedRevs_body.php
1 file changed, 7 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ApprovedRevs
refs/changes/71/366171/1
diff --git a/ApprovedRevs_body.php b/ApprovedRevs_body.php
index f59a955..d279b25 100644
--- a/ApprovedRevs_body.php
+++ b/ApprovedRevs_body.php
@@ -14,7 +14,7 @@
static $mApprovedContentForPage = array();
static $mApprovedRevIDForPage = array();
static $mUserCanApprove = null;
-
+
/**
* Gets the approved revision ID for this page, or null if there isn't
* one.
@@ -49,8 +49,8 @@
* (otherwise).
*/
public static function getPageText( $title, $revisionID = null ) {
- $revision = Revision::newFromTitle( $title, $revisionID );
- return $revision->getContent()->getNativeData();
+ $revision = Revision::newFromTitle( $title, $revisionID
);
+ return $revision->getContent()->getNativeData();
}
/**
@@ -143,7 +143,8 @@
}
public static function userCanApprove( $title ) {
- global $egApprovedRevsSelfOwnedNamespaces;
+ global $egApprovedRevsSelfOwnedNamespaces, $wgUser;
+ $permission = 'approverevisions';
// $mUserCanApprove is a static variable used for
// "caching" the result of this function, so that
@@ -152,7 +153,8 @@
return true;
} elseif ( self::$mUserCanApprove === false ) {
return false;
- } elseif ( $title->userCan( 'approverevisions' ) ) {
+ } elseif ( $title->userCan( $permission )
+ || $wgUser->isAllowed( $permission ) ) {
self::$mUserCanApprove = true;
return true;
} else {
@@ -161,7 +163,6 @@
// revisions - it depends on whether the current
// namespace is within the admin-defined
// $egApprovedRevsSelfOwnedNamespaces array.
- global $wgUser;
$namespace = $title->getNamespace();
if ( in_array( $namespace,
$egApprovedRevsSelfOwnedNamespaces ) ) {
if ( $namespace == NS_USER ) {
--
To view, visit https://gerrit.wikimedia.org/r/366171
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I77e3c4bbe0b73b6d3992eaf41dbc6eec2ebbc82f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApprovedRevs
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits