fix(caldav): Do not overwrite shared calendar owner
- Resolves: #26668
Summary
Sabre invitation plugin skip invites if the organizer of the event is not the owner of the calendar. That happens for shared calendars because \OCA\DAV\CalDAV\Calendar::getOwner overwrites \Sabre\CalDAV\Calendar::getOwner. Upstream returns the principaluri of the owner, we return the principaluri of the sharee. Want to test if this revives the invites in shared calendars. Adjustments for other places that use the getOwner method might be required.
Setting to draft because we have to test this locally before it's integrated. We do not want to experiment with this on production instances
Setting to draft because we have to test this locally before it's integrated. We do not want to experiment with this on production instances
Agreed.
Test scenario
- Calendar "A-Team"
- Owned by Alice
- Shared editable with Bob, readonly with Jane
- Reoccurring event created by Alice (Weekly, Mo, 9am, start date in the future - no invitations for events in the past)
- Attendees are Alice, Bob, Jane, John, [email protected], [email protected], [email protected]
Case 1
Steps:
- Alice: Create event and add Bob and [email protected]
- Alice: Edit event and add Jane and [email protected]
- Bob: Edit event and add John and [email protected]
Expected outcome:
- [x] Alice can invite internal and external attendees
- [x] and the invitations are sent by email
- [x] Bob sees the event two times (1x in the personal calendar because he is also an attendee, 1x in the shared calendar)
- [x] Bob can invite internal and external attendees to the event in the shared calendar
- [x] and the invitations are sent by email
- [x] Jane sees the event two times (1x in the personal calendar because he is also an attendee, 1x in the shared calendar)
- [x] Jane cannot edit the event in the shared calendar
- [x] Internal users see the event in the calendar
- [x] Users can accept/decline the event
- [x] The status is updated properly for every user with a local account (note, it's important to accept the invitation for the right event - the copy in your personal calendar, if you accept the event in shared calendar the status for the copy in your personal calendar does not change until the next update from the event organizer)
- [x] External users receive an invitation by email
- [x] and can use the provided link to accept/decline
Case 2
Steps:
- Bob: Create event and add John and [email protected]
- Bob: Edit event and add Jane and [email protected]
Expected outcome:
- [x] Bob sees the event one time (the one in the shared calendar, there is no copy in bob's personal calendar)
- [x] Bob can invite internal and external attendees to the event in the shared calendar
- [x] and the invitations are sent by email
- [x] Jane sees the event two times (1x in the personal calendar because he is also an attendee, 1x in the shared calendar)
- [x] Jane cannot edit the event in the shared calendar
- [x] Internal users see the event in the calendar
- [x] Users can accept/decline the event
- [x] The status is updated properly for every user with a local account (the reply sent to bob does not trigger a status update because the event is not found at https://github.com/nextcloud/3rdparty/blob/cbcfacd52639b3201dd2cf507da3d440ea3344fe/sabre/dav/lib/CalDAV/Schedule/Plugin.php#L492)
- [x] External users receive an invitation by email
- [x] and can use the provided link to accept/decline
Summary
Sabre invitation plugin skip invites if the organizer of the event is not the owner of the calendar. That happens for shared calendars because \OCA\DAV\CalDAV\Calendar::getOwner overwrites \Sabre\CalDAV\Calendar::getOwner. Upstream returns the principaluri of the owner, we return the principaluri of the sharee. Want to test if this revives the invites in shared calendars. Adjustments for other places that use the getOwner method might be required.
Disregard... Initial comment...
The better solution is to supply both the Sharer and Sharee addresses to the iTipBroker... This keeps the calendar owner logic sounds and in tacked and fixes the reason the iTipBroker does not generate proper messages when a Sharee creates an event with attendees in the Sharers calendar.
Additional thoughts...
Some front end UI changes that would be beneficial...
- Drop down on attendee tab to selected the organizer of the event. Use cases...
- Sharee is an assistant with access to the Managers calendar (Sharer)... The organizer of the event should be the Sharer.
- Sharee is a employee with access to the Company calendar (Sharer)... The organizer of the event should be the Sharee.
Some back end changes that would be beneficial...
- Additional calendar property to control access to send on behalf of the Sharer.
Draw backs...
- The above features would only work in the NC UI. CalDAV dose support the "CALDAV:schedule-send" ACL permission but I doubt that there are many if any clients that actually support this feature.
Testing Instructions:
- Pull Patch and Calendar patch https://github.com/nextcloud/calendar/pull/6202 (enables attendee selection from UI)
- Create invite as an Sharee (User B) on a shared calendar (from User A) with attendees (User C).
- Check email of User C to see if invitation arrived.
- Repeat step 2 and 3 by creating invite in personal calendar with attendees
@SebastianKrupinski as discussed, this is a critical change. We will not send this into production without a good test coverage.
- Tests that cover the old invitation workflows
- Tests that cover the new invitation workflows
@ChristophWurst yes I am working on the tests, wasn't planning on merging this without them, just wanted some reviews on the subject.
Notes: Testing Current Shared Calendar Behavior Configuration: User 2 (Sharer/Owner), User 1 (Sharee), User 3 (Non-Sharee), User External (Mail Address)
Case 1 Test: User 2 (Owner) Creates event with all other users
Case 1 Outcome: User 2 (Owner) - SEEs event in shared calendar and receives NO email User 1 (Sharee) - SEEs two events, one in personal and one in shared calendar and RECEIVES an email User 3 (Non-Sharee) - SEEs event in personal calendar and RECEIVES an email User E (External) - RECEIVES an email
Case 2 Test: User 1 (Sharee) Creates event with all other users
Case 2 Outcome: User 1 (Sharee) - SEEs event in shared calendar and receives NO email User 2 (Owner) - SEEs event in shared calendar and receives NO email User 3 (Non-Sharee) - Dose NOT see event in personal calendar and receives NO email User E (External) - receives NO email
Notes: Testing New Shared Calendar Behavior Configuration: User 2 (Sharer/Owner), User 1 (Sharee), User 3 (Non-Sharee), User External (Mail Address)
Case 3 Test: User 2 (Owner) Creates event with all other users
Case 3 Outcome: User 2 (Owner) - SEEs event in shared calendar and receives NO email User 1 (Sharee) - SEEs two events, one in personal and one in shared calendar and RECEIVES an email User 3 (Non-Sharee) - SEEs event in personal calendar and RECEIVES an email User E (External) - RECEIVES an email
Case 4 Test: User 1 (Sharee) Creates event with all other users
Case 4 Outcome: User 1 (Sharee) - SEEs event in shared calendar and receives NO email User 2 (Owner) - SEEs two events, one in personal and one in shared calendar and RECEIVES an email User 3 (Non-Sharee) - SEEs event in personal calendar and RECEIVES an email User E (External) - RECEIVES an email
I tried reproducing the 1st use case from Daniel but I can't add an additional attendee from the secondary user Bob with whom the calendar was shared. Am I missing something?
@miaulalala
Did you enable the UI selection from the calendar PR?
https://github.com/nextcloud/server/pull/45054#issuecomment-2247832392
Works, although the following issue might be confusing:
Admin invites Bob Bob has 2 copies of the VEVENT - one in the shared calendar, one in the personal calendar Bob deletes the VEVENT from the personal calendar Bob accepts the invitiation in the shared calendar The event in the personal calendar is recreated
Works, although the following issue might be confusing:
Admin invites Bob Bob has 2 copies of the VEVENT - one in the shared calendar, one in the personal calendar Bob deletes the VEVENT from the personal calendar Bob accepts the invitiation in the shared calendar The event in the personal calendar is recreated
Pretty sure we would need to rewrite the Sabre iTipBroker class to fix this.
Thank you all, most especially SebastianKrupinski, for the dedicated work on this.
I determined my skills at present were insufficient to assist in the testing, but I truly appreciate the work and am anxious to try it out.