diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-08-07 23:31:06 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-08-07 23:31:06 +0200 |
commit | 35a1738a39fbce50ec22561a0308d9a672eb6c78 (patch) | |
tree | 017960b15f6f2d69e845ecdd6b292678c3bd1a5e /apps/calendar | |
parent | d4882df8cbb7f7417d098363192824b3a36b53f1 (diff) | |
download | nextcloud-server-35a1738a39fbce50ec22561a0308d9a672eb6c78.tar.gz nextcloud-server-35a1738a39fbce50ec22561a0308d9a672eb6c78.zip |
Use new sharing API in OC_Calendar_Share::allSharedwithuser
Diffstat (limited to 'apps/calendar')
-rw-r--r-- | apps/calendar/lib/share.php | 21 | ||||
-rw-r--r-- | apps/calendar/lib/share/calendar.php | 8 |
2 files changed, 16 insertions, 13 deletions
diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php index 4fe88171403..e5ffc04143a 100644 --- a/apps/calendar/lib/share.php +++ b/apps/calendar/lib/share.php @@ -18,19 +18,16 @@ class OC_Calendar_Share{ * @return: array $return - information about calendars */ public static function allSharedwithuser($userid, $type, $active=null, $permission=null){ - $group_where = self::group_sql(OC_Group::getUserGroups($userid)); - $permission_where = self::permission_sql($permission); - if($type == self::CALENDAR){ - $active_where = self::active_sql($active); - }else{ - $active_where = ''; - } - $stmt = OCP\DB::prepare("SELECT * FROM *PREFIX*calendar_share_" . $type . " WHERE ((share = ? AND sharetype = 'user') " . $group_where . ") AND owner <> ? " . $permission_where . " " . $active_where); - $result = $stmt->execute(array($userid, $userid)); - $return = array(); - while( $row = $result->fetchRow()){ - $return[] = $row; + $format = OC_Share_Backend_Calendar::FORMAT_CALENDAR; + if ($type == self::EVENT) { + $format = OC_Share_Backend_Event::FORMAT_EVENT; } + $return = OCP\Share::getItemsSharedWith($type, + $format, + array( + 'active' => $active, + 'permissions' => $permission, + )); return $return; } /** diff --git a/apps/calendar/lib/share/calendar.php b/apps/calendar/lib/share/calendar.php index 9b68437531f..0ddca2400a9 100644 --- a/apps/calendar/lib/share/calendar.php +++ b/apps/calendar/lib/share/calendar.php @@ -43,8 +43,14 @@ class OC_Share_Backend_Calendar implements OCP\Share_Backend_Collection { $calendars = array(); if ($format == self::FORMAT_CALENDAR) { foreach ($items as $item) { - $calendar = OC_Calendar_App::getCalendar($item['item_source']); + $calendar = OC_Calendar_App::getCalendar($item['item_source'], false); + // TODO: really check $parameters['permissions'] == 'rw'/'r' + if ($parameters['permissions'] == 'rw') { + continue; // TODO + } $calendar['displaynamename'] = $item['item_target']; + $calendar['calendarid'] = $calendar['id']; + $calendar['owner'] = $calendar['userid']; $calendars[] = $calendar; } } |