Implement comprehensive CalDAV calendar integration to import calendar events as time entries from CalDAV-compatible servers (Zimbra, Nextcloud, ownCloud). Features: - CalDAV client with calendar discovery and event fetching - Automatic calendar discovery from server URL - Import calendar events (VEVENT) as time entries - Project matching from event titles with fallback to default project - Idempotent sync using IntegrationExternalEventLink to prevent duplicates - Per-user integration setup (similar to Google Calendar) - Support for both server URL (with discovery) and direct calendar URL - SSL certificate verification toggle for self-signed certificates - Configurable lookback period for event import Components: - CalDAVCalendarConnector: Main integration connector with sync logic - CalDAVClient: Low-level CalDAV client using PROPFIND/REPORT requests - IntegrationExternalEventLink: Model for tracking imported events (idempotency) - Setup UI: User-friendly form for configuration - Comprehensive validation and error handling - Full test coverage (unit, integration, route tests) - Documentation: Setup guide and troubleshooting Technical details: - Uses icalendar library for parsing VEVENT components - Handles timezone conversion (CalDAV UTC to app local timezone) - Skips all-day events (only imports timed events) - Stores credentials securely (password in access_token, username in extra_data) - Automatic calendar discovery on first sync if only server URL provided Migration: - Adds integration_external_event_links table for sync tracking - Unique constraint on (integration_id, external_uid) prevents duplicates Documentation: - CALDAV_INTEGRATION.md: Complete feature documentation - CALDAV_QUICK_SETUP.md: Step-by-step setup guide with examples Closes feature request for CalDAV/Zimbra integration.
5.2 KiB
CalDAV Integration - Quick Setup Guide
Prerequisites
- At least one active project in TimeTracker
- CalDAV server credentials (username and password)
- CalDAV server URL or direct calendar URL
Step-by-Step Setup
Step 1: Navigate to Integrations
- Log in to TimeTracker
- Click on Integrations in the main menu
- Find CalDAV Calendar in the list
- Click Setup CalDAV Calendar
Step 2: Configure Server Connection
For Zimbra Users:
-
Server URL: Enter your Zimbra CalDAV base URL
https://mail.yourdomain.com/dav- Replace
yourdomain.comwith your actual domain - The system will automatically discover your calendars
- Replace
-
Calendar URL (Optional): If you know the exact calendar URL, you can enter it directly:
https://mail.yourdomain.com/dav/username@yourdomain.com/Calendar/
For Nextcloud/ownCloud Users:
-
Server URL: Enter your Nextcloud/ownCloud CalDAV URL
https://nextcloud.yourdomain.com/remote.php/dav -
Calendar URL (Optional): Direct calendar URL
https://nextcloud.yourdomain.com/remote.php/dav/calendars/username/calendar-name/
Step 3: Enter Authentication
-
Username: Your email address or CalDAV username
- For Zimbra: Usually your full email address
- For Nextcloud: Your Nextcloud username
-
Password: Your CalDAV password
- For Zimbra: Your email password or app-specific password
- For Nextcloud: Your Nextcloud password or app password
-
Verify SSL:
- ✅ Checked (recommended): For servers with valid SSL certificates
- ❌ Unchecked: Only if using self-signed certificates
Step 4: Configure Import Settings
-
Default Project: Select the project where imported events will be assigned
- Important: You must have at least one active project
- If an event title contains a project name, that project will be used instead
-
Lookback Days: How many days back to import events (default: 90)
- Range: 1-365 days
- Only events within this range will be imported
Step 5: Save and Test
- Click Save Configuration
- You'll be redirected to the integration details page
- Click Test Connection to verify:
- Server connectivity
- Authentication
- Calendar discovery (if server URL provided)
- If successful, you'll see available calendars
Step 6: Import Events
- On the integration details page, click Sync Now
- The system will:
- Fetch calendar events from your CalDAV server
- Import them as time entries
- Skip duplicates (using event UIDs)
- Check the sync history for results
Common Issues and Solutions
"No active projects found"
Problem: You need at least one active project before setting up CalDAV.
Solution:
- Go to Projects → Create Project
- Create at least one project
- Return to CalDAV setup
"Either server URL or calendar URL is required"
Problem: You must provide at least one URL.
Solution:
- Enter either the Server URL (for automatic discovery) or Calendar URL (direct connection)
- Server URL is recommended for first-time setup
"Connection test failed"
Possible causes:
- Wrong URL: Double-check the server URL format
- Wrong credentials: Verify username and password
- SSL certificate: If using self-signed certificate, uncheck "Verify SSL"
- Firewall: Ensure port 443 (HTTPS) is accessible
Solution:
- Verify the URL format matches your server
- Test credentials with a CalDAV client (e.g., Thunderbird)
- Check server logs for connection attempts
"No calendars found on server"
Problem: The server URL is correct but no calendars are discovered.
Solution:
- Try entering the Calendar URL directly instead
- Check that your account has calendar access
- Verify the server supports CalDAV
"No events imported"
Possible causes:
- Time range: Events are outside the lookback period
- All-day events: Only timed events are imported
- No events: Calendar is empty
Solution:
- Increase the lookback days if needed
- Ensure events have start and end times (not all-day)
- Check your calendar has events in the time range
Tips for Best Results
- Use Server URL for Discovery: Let the system discover calendars automatically
- Project Matching: Name your calendar events with project names for automatic matching
- Example: "Meeting - Project Alpha" will match to "Project Alpha" project
- Regular Syncs: Manually sync periodically to import new events
- Check Sync History: Review the integration details page for sync status and errors
Example: Zimbra Setup
Server URL: https://mail.company.com/dav
Username: john.doe@company.com
Password: [your password]
Default Project: General Work
Lookback Days: 90
After saving:
- Test connection → Should show available calendars
- Sync now → Imports events from the last 90 days
- Check time entries → Events appear as time entries
Next Steps
After setup:
- ✅ Test connection to verify everything works
- ✅ Run initial sync to import existing events
- ✅ Check imported time entries
- ✅ Set up regular syncs (manual for now)
For more details, see CALDAV_INTEGRATION.md.