Add a special abstract method PlUser::password(): we want to be able to
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 30 Dec 2008 21:54:09 +0000 (22:54 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 30 Dec 2008 21:55:52 +0000 (22:55 +0100)
fetch the password of a user but we don't want to store this password
in the session (or whatever).

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/mmlist.php
classes/pluser.php

index a16b1c6..9dadd09 100644 (file)
 
 class MMList extends XmlrpcClient
 {
-    public function __construct($uid, $pass, $fqdn = null)
+    public function __construct($user, $pass = null, $fqdn = null)
     {
         global $globals;
+        if ($user instanceof PlUser) {
+            $fqdn = $pass;
+            $uid  = $user->id();
+            $pass = $user->password();
+        } else {
+            $uid = $user;
+        }
 
         $dom = is_null($fqdn) ? $globals->mail->domain : $fqdn;
         $url = "http://$uid:$pass@{$globals->lists->rpchost}:{$globals->lists->rpcport}/$dom";
index 0377bdc..ef9c58f 100644 (file)
@@ -154,6 +154,8 @@ abstract class PlUser
         return $this->promo;
     }
 
+    abstract public function password();
+
     // Fallback value is GENDER_MALE.
     public function isFemale()
     {