From: Florent Bruneau Date: Tue, 28 Sep 2010 12:58:07 +0000 (+0200) Subject: Add PlUser::isMe($other): returns true if $other is a reference to the X-Git-Tag: core/1.1.1~18 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=792e4607bafa557ff5bde3b4e4da9406cfbc3111;p=platal.git Add PlUser::isMe($other): returns true if $other is a reference to the same user. Signed-off-by: Florent Bruneau --- diff --git a/classes/pluser.php b/classes/pluser.php index 187f131..746ec59 100644 --- a/classes/pluser.php +++ b/classes/pluser.php @@ -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)) {