r48012 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48011‎ | r48012 | r48013 >
Date:05:12, 4 March 2009
Author:werdna
Status:ok
Tags:
Comment:
(bug 16303) Add a javascript variable for global groups. Patch by ^demon, with a basic syntax error fixed.
Modified paths:
  • /trunk/extensions/CentralAuth/CentralAuth.php (modified) (history)
  • /trunk/extensions/CentralAuth/CentralAuthHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/CentralAuth.php
@@ -171,6 +171,7 @@
172172 $wgHooks['UserSetCookies'][] = 'CentralAuthHooks::onUserSetCookies';
173173 $wgHooks['UserLoadDefaults'][] = 'CentralAuthHooks::onUserLoadDefaults';
174174 $wgHooks['getUserPermissionsErrorsExpensive'][] = 'CentralAuthHooks::onGetUserPermissionsErrorsExpensive';
 175+$wgHooks['MakeGlobalVariablesScript'][] = 'CentralAuthHooks::onMakeGlobalVariablesScript';
175176
176177 // For interaction with the Special:Renameuser extension
177178 $wgHooks['RenameUserWarning'][] = 'CentralAuthHooks::onRenameUserWarning';
Index: trunk/extensions/CentralAuth/CentralAuthHooks.php
@@ -484,6 +484,17 @@
485485
486486 return true;
487487 }
 488+
 489+ static function onMakeGlobalVariablesScript( $groups ) {
 490+ global $wgUser;
 491+ if ( !$wgUser->isAnon() ) {
 492+ $centralUser = CentralAuthUser::getInstance( $wgUser );
 493+ if ($centralUser->exists() && $centralUser->isAttached()) {
 494+ $groups['wgGlobalGroups'] = $centralUser->getGlobalGroups();
 495+ }
 496+ }
 497+ return true;
 498+ }
488499
489500 /**
490501 * Destroy local login cookies so that remote logout works

Status & tagging log