/** * @param $user User * @return bool */ public function updateUser(&$user) { global $caImportGroups, $caOverwriteLocalGroups; if (!$caImportGroups) { return true; } /* * Find the groups this user is a member of. */ $groups = $this->crowd->findGroupMemberships(array("in0" => $this->token, "in1" => $user->getName())); $groups = $groups->out->string; $dbw = wfGetDB(DB_MASTER); if ($caOverwriteLocalGroups) { $dbw->delete('user_group', array('ug_user' => $user->getId())); } foreach ($groups as $group) { $user->addGroup($group); } return true; }