Add PlUser::isMe($other): returns true if $other is a reference to the
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 28 Sep 2010 12:58:07 +0000 (14:58 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 28 Sep 2010 12:58:07 +0000 (14:58 +0200)
same user.

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

index 187f131..746ec59 100644 (file)
@@ -146,6 +146,17 @@ abstract class PlUser implements PlUserInterface
         return $this->hruid;
     }
 
+    public function isMe($other)
+    {
+        if (!$other) {
+            return false;
+        } else if ($other instanceof PlUser) {
+            return $other->id() == $this->id();
+        } else {
+            return false;
+        }
+    }
+
     public function bestEmail()
     {
         if (!empty($this->bestalias)) {