From: Michael J. Rubinsky Date: Wed, 9 Sep 2009 19:31:28 +0000 (-0400) Subject: Move hasPermisson to the base class, implement ::get() to behave like X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=10bffed0f8d2bc8bb00c11058e6a6fb8ceb2e211;p=horde.git Move hasPermisson to the base class, implement ::get() to behave like a share. --- diff --git a/kronolith/lib/Resource/Base.php b/kronolith/lib/Resource/Base.php index 35dde643f..e3a4b2459 100644 --- a/kronolith/lib/Resource/Base.php +++ b/kronolith/lib/Resource/Base.php @@ -46,6 +46,38 @@ abstract class 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; + } + + /** + * Implemented to stand in as a share object. + * + * @param $property + * @return unknown_type + */ + public function get($property) + { + return $this->{$property}; + } + + + + /** * Should this take an event, or a time range? * * @param $startTime diff --git a/kronolith/lib/Resource/Single.php b/kronolith/lib/Resource/Single.php index 874f1b3d6..25a89dcf8 100644 --- a/kronolith/lib/Resource/Single.php +++ b/kronolith/lib/Resource/Single.php @@ -124,21 +124,4 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base throw new Horde_Exception(_("Resource already exists. Cannot change the id.")); } } - - /** - * @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 diff --git a/kronolith/resources.php b/kronolith/resources.php index cffeebe39..4117e6f80 100644 --- a/kronolith/resources.php +++ b/kronolith/resources.php @@ -72,10 +72,10 @@ var_dump($resources); $resource = Kronolith::getDriver('Resource')->getResource(9); /* Any driver/event */ -//$driver = Kronolith::getDriver('Sql'); -//$event = $driver->getByUID('20090904121938.17551lvwtt52y728@localhost'); -//$event->addResource($resource, Kronolith::RESPONSE_NONE); -//$event->save(); +$driver = Kronolith::getDriver('Sql'); +$event = $driver->getByUID('20090909152832.6360407aq83e5nsw@localhost'); +$event->addResource($resource, Kronolith::RESPONSE_NONE); +$event->save(); // diff --git a/kronolith/templates/edit/edit.inc b/kronolith/templates/edit/edit.inc index 22c84a1a5..3a94947f0 100644 --- a/kronolith/templates/edit/edit.inc +++ b/kronolith/templates/edit/edit.inc @@ -1,4 +1,5 @@ -isLocked('default_share') && count($calendars) > 1); ?> +isLocked('default_share') && count($calendars) > 1 && empty($GLOBALS['show_resource_calendars'])); ?> +
@@ -68,19 +69,28 @@