Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/72765


Change subject: Don't skip UserGetRights hook in addGroup/removeGroup
......................................................................

Don't skip UserGetRights hook in addGroup/removeGroup

The addGroup and removeGroup functions in User were reloading the cached
mRights, but not calling the UserGetRights hook that is supposed to
allow for extensions to modify the rights list. Instead, let's just null
the cache so it will be reloaded next time something calls
$user->getRights().

Note we still call $this->getEffectiveGroups( true ), though, to trigger
that to recache.

Change-Id: I81784917303b639bc7c22c726e9cbdb0d191e674
---
M includes/User.php
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/65/72765/1

diff --git a/includes/User.php b/includes/User.php
index bb61e80..b83fa5b 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -2712,7 +2712,8 @@
                // In case loadGroups was not called before, we now have the 
right twice.
                // Get rid of the duplicate.
                $this->mGroups = array_unique( $this->mGroups );
-               $this->mRights = User::getGroupPermissions( 
$this->getEffectiveGroups( true ) );
+               $this->getEffectiveGroups( true );
+               $this->mRights = null;
 
                $this->invalidateCache();
        }
@@ -2742,7 +2743,8 @@
                }
                $this->loadGroups();
                $this->mGroups = array_diff( $this->mGroups, array( $group ) );
-               $this->mRights = User::getGroupPermissions( 
$this->getEffectiveGroups( true ) );
+               $this->getEffectiveGroups( true );
+               $this->mRights = null;
 
                $this->invalidateCache();
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/72765
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I81784917303b639bc7c22c726e9cbdb0d191e674
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to