r27040 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r27039‎ | r27040 | r27041 >
Date:02:34, 30 October 2007
Author:river
Status:old
Tags:
Comment:
should have a way to set default group memberships
Modified paths:
  • /trunk/extensions/CrowdAuthentication/CrowdAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CrowdAuthentication/CrowdAuthentication.php
@@ -16,6 +16,7 @@
1717 * $caApplicationName = 'mediawiki';
1818 * $caApplicationPassword = 'whatever';
1919 * $caCrowdServerUrl = 'http://localhost:8095/crowd/services';
 20+ * $caDefaultGroups = array("jira-users", "confluence-users");
2021 * $wgAuth = new CrowdAuthenticator();
2122 *
2223 */
@@ -175,6 +176,7 @@
176177
177178 public function /*bool*/ addUser(/*User*/ $user, /*string*/ $password,
178179 /*string*/ $email = '', /*string*/ $realname = '') {
 180+ global $caDefaultGroups;
179181 $crowd = $this->getCrowd();
180182 $nameparts = split(" ", $realname, 2);
181183 $firstname = $lastname = "";
@@ -203,6 +205,9 @@
204206 $crowd->addPrincipal(array("in0" => $this->token,
205207 "in1" => $principal,
206208 "in2" => $cred));
 209+ foreach ($caDefaultGroups as $group)
 210+ $crowd->addPrincipalToGroup(array("in0" => $this->token, "in1" => $user->getName(), "in2" => $group));
 211+
207212 return true;
208213 } catch (Exception $e) {
209214 return false;

Status & tagging log