Robert Vogel has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/375815 )

Change subject: GroupHelper: Fixed REL1_30 issue
......................................................................

GroupHelper: Fixed REL1_30 issue

Direct access to 'User::mGroups' is not allowed anymore. So we use the new
'expire' mechanism to add a temporary group

Also: removed deprecated method

Change-Id: Ie43828cde9bc255d08737c7c1b7ed54e0098ebed
---
M extension.json
M includes/utility/GroupHelper.class.php
2 files changed, 4 insertions(+), 41 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation 
refs/changes/15/375815/1

diff --git a/extension.json b/extension.json
index 0237668..9b4c505 100644
--- a/extension.json
+++ b/extension.json
@@ -413,7 +413,6 @@
                "SkinTemplateOutputPageBeforeExec": 
"BsCoreHooks::onSkinTemplateOutputPageBeforeExec",
                "SkinAfterContent": "BsCoreHooks::onSkinAfterContent",
                "ParserFirstCallInit": "BsCoreHooks::onParserFirstCallInit",
-               "UserAddGroup": "BsGroupHelper::addTemporaryGroupToUserHelper",
                "ExtensionTypes": "BsCoreHooks::onExtensionTypes",
                "PageContentSaveComplete": 
"BsCoreHooks::onPageContentSaveComplete",
                "UnitTestsList": "BsCoreHooks::onUnitTestsList",
diff --git a/includes/utility/GroupHelper.class.php 
b/includes/utility/GroupHelper.class.php
index a8afc80..abee28d 100644
--- a/includes/utility/GroupHelper.class.php
+++ b/includes/utility/GroupHelper.class.php
@@ -76,7 +76,10 @@
        public static function addTempGroupToUser( $oUser, $sGroupName ) {
 
                self::$sTempGroup = $sGroupName;
-               $oUser->addGroup( $sGroupName );
+               if( in_array( self::$sTempGroup, $oUser->getEffectiveGroups() ) 
) {
+                       return true;
+               }
+               $oUser->addGroup( $sGroupName, wfTimestamp( TS_MW, time() + 60 
) );
 
                return true;
        }
@@ -113,45 +116,6 @@
                                        = $sGroupName;
                        }
                }
-       }
-
-       /**
-        * DEPRECATED!
-        * Use GroupHelper::addTempGroupToUser and 
GroupHelper::addPermissionsToGroup
-        * @deprecated since 2.23.1
-        * @param User $oUser
-        * @param String $sGroupName
-        * @param Array $aPermissions
-        * @param Title $oTitle
-        * @return NULL
-        */
-       public static function addTemporaryGroupToUser( $oUser, $sGroupName, 
$aPermissions, Title $oTitle = null ) {
-               //Deprecated, use GroupHelper::addTempGroupToUser and 
GroupHelper::addPermissionsToGroup
-
-               $aNamespaces = array();
-               if( !is_null($oTitle) ) {
-                       $aNamespaces[] = $oTitle->getNamespace();
-               }
-
-               self::addPermissionsToGroup( $sGroupName, $aPermissions, 
$aNamespaces );
-               self::addTempGroupToUser($oUser, $sGroupName);
-       }
-
-       /**
-        * Hook-Handler for MediaWiki hook UserAddGroup
-        * @param User $user
-        * @param String $group
-        * @return boolean - returns false to skip saving group into db
-        */
-       public static function addTemporaryGroupToUserHelper( $user, &$group ) {
-               if ( empty( self::$sTempGroup ) || self::$sTempGroup !== $group 
) return true;
-               self::$sTempGroup = '';
-
-               //Mw 1.27 compatibility
-               $user->mGroups[] = $group;
-               $user->mGroups = array_unique( $user->mGroups );
-
-               return false;
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie43828cde9bc255d08737c7c1b7ed54e0098ebed
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Robert Vogel <[email protected]>

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

Reply via email to