Skip to content

Commit

Permalink
Don't show "free" blocks for users that are not found.
Browse files Browse the repository at this point in the history
If the share isn't found, do not default to showing the
time as free, since this could possibly hide the fact that
a user-attendee's name was entered incorrectly.
  • Loading branch information
mrubinsk committed Jul 21, 2016
1 parent a6fbfef commit 4dd2374
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions kronolith/lib/FreeBusy.php
Expand Up @@ -18,7 +18,7 @@ class Kronolith_FreeBusy
* @param string $user Set organizer to this user.
*
* @return string The free/busy text.
* @throws Horde_Exception
* @throws Horde_Exception, Kronolith_Exception
*/
public static function generate($calendars, $startstamp = null,
$endstamp = null, $returnObj = false,
Expand Down Expand Up @@ -76,6 +76,11 @@ public static function generate($calendars, $startstamp = null,
} else {
$type = 'internal';
}
try {
$GLOBALS['injector']->getInstance('Kronolith_Shares')->getShare($calendar);
} catch (Horde_Exception $e) {
throw new Kronolith_Exception('Share not found.');
}
try {
$driver = Kronolith::getDriver($type, $calendar);
$events = $driver->listEvents(
Expand Down Expand Up @@ -180,7 +185,12 @@ public static function getForUser($user, $opts = array())
}
$cals = array('internal_' . $cal);
}
$fb = self::generate($cals, $opts['start'], $opts['end'], true, $user);

try {
$fb = self::generate($cals, $opts['start'], $opts['end'], true, $user);
} catch (Kronolith_Exception $e) {
throw new Kronolith_Exception(sprintf(_("The free/busy data for %s cannot be retrieved."), $user));
}

return $opts['json'] ? self::toJson($fb) : $fb;
}
Expand Down

0 comments on commit 4dd2374

Please sign in to comment.