Guest User

Untitled

a guest
Apr 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.47 KB | None | 0 0
  1. Index: CrowdAuthentication/CrowdAuthentication.php
  2. ===================================================================
  3. --- CrowdAuthentication/CrowdAuthentication.php (revision 78055)
  4. +++ CrowdAuthentication/CrowdAuthentication.php (working copy)
  5. @@ -165,18 +165,15 @@
  6.          * Find the groups this user is a member of.
  7.          */
  8.  
  9. -       $restr = new caSearchRestriction();
  10. -       $restr->name = "group.principal.member";
  11. -       $restr->value = $this->findUsername($user->getName());
  12. -       $groups = $this->crowd->searchGroups(array("in0" => $this->token, "in1" => array($restr)));
  13. -       $groups = $groups->out->SOAPGroup;
  14. +       $groups = $this->crowd->findGroupMemberships(array("in0" => $this->token, "in1" => $user->getName()));
  15. +       $groups = $groups->out->string;
  16.  
  17.         $dbw = wfGetDB(DB_MASTER);
  18.         if ($caOverwriteLocalGroups)
  19.             $dbw->delete('user_group', array('ug_user' => $user->getId()));
  20.  
  21.         foreach ($groups as $group) {
  22. -           $user->addGroup($group->name);
  23. +           $user->addGroup($group);
  24.         }
  25.     }
  26.  
  27. @@ -219,7 +216,7 @@
  28.         $nameparts = split(" ", $realname, 2);
  29.         $firstname = $user->getName();
  30.         $lastname = "";
  31. -       if (count($nameparts) > 0)
  32. +       if (count($nameparts) > 0 && strlen($nameparts[0]))
  33.             $firstname = $nameparts[0];
  34.         if (count($nameparts) > 1)
  35.             $lastname = $nameparts[1];
  36. @@ -231,10 +228,10 @@
  37.             new caSOAPAttribute("mail", $email),
  38.             new caSOAPAttribute("givenName", $firstname),
  39.             new caSOAPAttribute("sn", $lastname),
  40. -           new caSOAPAttribute("invalidPasswordAttempts", 0),
  41. -           new caSOAPAttribute("lastAuthenticated", 0),
  42. -           new caSOAPAttribute("passwordLastChanged", 0),
  43. -           new caSOAPAttribute("requiresPasswordChange", 0),
  44. +       #   new caSOAPAttribute("invalidPasswordAttempts", 0),
  45. +       #   new caSOAPAttribute("lastAuthenticated", 0),
  46. +       #   new caSOAPAttribute("passwordLastChanged", 0),
  47. +       #   new caSOAPAttribute("requiresPasswordChange", 0),
  48.         );
  49.         $principal->active = true;
  50.         $principal->conception = 0;
  51. @@ -244,8 +241,12 @@
  52.             $crowd->addPrincipal(array("in0" => $this->token,
  53.                            "in1" => $principal,
  54.                            "in2" => $cred));
  55. -           foreach ($caDefaultGroups as $group)
  56. -               $crowd->addPrincipalToGroup(array("in0" => $this->token, "in1" => $user->getName(), "in2" => $group));
  57. +           foreach ($caDefaultGroups as $group) {
  58. +               // XXX hack
  59. +               try {
  60. +                   $crowd->addPrincipalToGroup(array("in0" => $this->token, "in1" => $user->getName(), "in2" => $group));
  61. +               } catch (Exception $e) { }
  62. +           }
  63.  
  64.             return true;
  65.         } catch (Exception $e) {
Add Comment
Please, Sign In to add comment