From: Michael J. Rubinsky Date: Wed, 9 Sep 2009 18:49:02 +0000 (-0400) Subject: listEvents:: isn't detailed enough for this...manually compare X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b048e13c30b7ed700cc234b109f629ca465bb60c;p=horde.git listEvents:: isn't detailed enough for this...manually compare start/end times to determine if an event collides. Add basic hasPermission method, not sure if it's really needed yet. --- diff --git a/kronolith/lib/Resource/Single.php b/kronolith/lib/Resource/Single.php index 3b0156dc1..874f1b3d6 100644 --- a/kronolith/lib/Resource/Single.php +++ b/kronolith/lib/Resource/Single.php @@ -42,7 +42,12 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base $e->hasStatus(Kronolith::STATUS_FREE)) && $e->getUID() !== $uid) { - return false; + if (!($e->start->compareDateTime($event->end) >= 1 || + $e->end->compareDateTime($event->start) <= -1)) { + // $e starts after $event ends OR $e ends before $event->start + + return false; + } } } } @@ -120,4 +125,20 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base } } + /** + * @TODO: need to fine tune this + * @param $user + * @param $permission + * @param $restrict + * @return unknown_type + */ + public function hasPermission($user, $permission = PERMS_READ, $restrict = null) + { + if (Horde_Auth::isAdmin()) { + return true; + } + + return false; + } + } \ No newline at end of file