Index: trunk/extensions/CrowdAuthentication/CrowdAuthentication.php |
— | — | @@ -16,6 +16,7 @@ |
17 | 17 | * $caApplicationName = 'mediawiki'; |
18 | 18 | * $caApplicationPassword = 'whatever'; |
19 | 19 | * $caCrowdServerUrl = 'http://localhost:8095/crowd/services'; |
| 20 | + * $caDefaultGroups = array("jira-users", "confluence-users"); |
20 | 21 | * $wgAuth = new CrowdAuthenticator(); |
21 | 22 | * |
22 | 23 | */ |
— | — | @@ -175,6 +176,7 @@ |
176 | 177 | |
177 | 178 | public function /*bool*/ addUser(/*User*/ $user, /*string*/ $password, |
178 | 179 | /*string*/ $email = '', /*string*/ $realname = '') { |
| 180 | + global $caDefaultGroups; |
179 | 181 | $crowd = $this->getCrowd(); |
180 | 182 | $nameparts = split(" ", $realname, 2); |
181 | 183 | $firstname = $lastname = ""; |
— | — | @@ -203,6 +205,9 @@ |
204 | 206 | $crowd->addPrincipal(array("in0" => $this->token, |
205 | 207 | "in1" => $principal, |
206 | 208 | "in2" => $cred)); |
| 209 | + foreach ($caDefaultGroups as $group) |
| 210 | + $crowd->addPrincipalToGroup(array("in0" => $this->token, "in1" => $user->getName(), "in2" => $group)); |
| 211 | + |
207 | 212 | return true; |
208 | 213 | } catch (Exception $e) { |
209 | 214 | return false; |