Returns whether the current user has certain permissions on a tasklist.
/** */ public function davDeleteObject($collection, $object) { $dav = $GLOBALS['injector']->getInstance('Horde_Dav_Storage'); $internal = $dav->getInternalCollectionId($collection, 'tasks') ?: $collection; if (!Nag::hasPermission($internal, Horde_Perms::DELETE)) { throw new Nag_Exception("Task List does not exist or no permission to delete"); } try { $object = $dav->getInternalObjectId($object, $internal) ?: preg_replace('/\\.ics$/', '', $object); } catch (Horde_Dav_Exception $e) { } $GLOBALS['injector']->getInstance('Nag_Factory_Driver')->create($internal)->delete($object); try { $dav->deleteExternalObjectId($object, $internal); } catch (Horde_Dav_Exception $e) { } }
/** * Saves properties of a time object back to the task that it represents. * * At the moment only the title, description and due date are saved. * * @param array $timeobject A time object hash. * @throws Nag_Exception */ public function saveTimeObject(array $timeobject) { if (!Nag::hasPermission($timeobject['params']['tasklist'], Horde_Perms::EDIT)) { throw new Horde_Exception_PermissionDenied(); } $storage = $GLOBALS['injector']->getInstance('Nag_Factory_Driver')->create($timeobject['params']['tasklist']); $existing = $storage->get($timeobject['id']); $info = array(); if (isset($timeobject['start'])) { $info['due'] = new Horde_Date($timeobject['start']); $info['due'] = $info['due']->timestamp(); } if (isset($timeobject['title'])) { $info['name'] = $timeobject['title']; } if (isset($timeobject['description'])) { $info['desc'] = $timeobject['description']; } $storage->modify($timeobject['id'], $info); }