-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: OCC and OCS Calendar Import/Export #6596
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: SebastianKrupinski <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6596 +/- ##
============================================
- Coverage 23.40% 23.20% -0.21%
- Complexity 472 510 +38
============================================
Files 249 252 +3
Lines 11901 12004 +103
Branches 2282 2279 -3
============================================
Hits 2786 2786
- Misses 8788 8891 +103
Partials 327 327
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I think it feels odd to have this in the calendar as other calendar commands are into the |
'jcal' => '["vcalendar",[["version",{},"text","2.0"],["prodid",{},"text","-\/\/IDN nextcloud.com\/\/Calendar App\/\/EN"]],[', | ||
'xcal' => '<?xml version="1.0" encoding="UTF-8"?><icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0"><vcalendar><properties><version><text>2.0</text></version><prodid><text>-//IDN nextcloud.com//Calendar App//EN</text></prodid></properties><components>', | ||
default => "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//IDN nextcloud.com//Calendar App//EN\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like hardcoding things here. Would it be possible to serialize an empty calendar to get the start string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I don't like hard coding this either. But I could not think of a better way to do this.
Yes, I could serialize a empty object but then I would still have to do fancy string manipulations to separate the beginning form the closing. Then output the beginning, then the objects, then the closing, as the output is a generated stream directly to the http buffer.
The only way to do this without hard coding would be to generate the calendar in memory and serialize it all as one. So it was a trade of hard coding or php memory exhaustion when exporting large calendars.
I wasn't sure where we wanted to put this, as the code can export any calendar, from any calendar provider, so its not just for DAV, it can easily be moved to server code. I will ask about it once CW is back. |
Summary
This adds the ability to export calendars via the OCS and OCC.
OCS
Endpoint: /ocs/v2.php/calendar/export
Request: GET/POST
{
"id": "personal",
"fmt": "xcal", (optional "ical, jcal, xcal", defaults to "ical")
"user": "user1" (optional admin permissions required)
}
OCC
Command: calendar:export
Arguments: userId calendarId format (optional) filepath
TODO
Checklist