Skip to content
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

fix(caldav): Add sharee to address list when calendar is shared #45054

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SebastianKrupinski
Copy link
Contributor

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.

@ChristophWurst
Copy link
Member

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

@ChristophWurst ChristophWurst added the 2. developing Work in progress label Apr 26, 2024
@ChristophWurst ChristophWurst changed the title fix: remove getowner override issue #26668 fix(caldav): Do not overwrite shared calendar owner Apr 26, 2024
@SebastianKrupinski
Copy link
Contributor Author

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.

@kesselb
Copy link
Contributor

kesselb commented May 23, 2024

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, veronica@mail.internal, kevin@mail.internal, mandy@mail.internal

Case 1

Steps:

  1. Alice: Create event and add Bob and veronica@mail.internal
  2. Alice: Edit event and add Jane and kevin@mail.internal
  3. Bob: Edit event and add John and mandy@mail.internal

Expected outcome:

  • Alice can invite internal and external attendees
  • and the invitations are sent by email
  • Bob sees the event two times (1x in the personal calendar because he is also an attendee, 1x in the shared calendar)
  • Bob can invite internal and external attendees to the event in the shared calendar
  • and the invitations are sent by email
  • Jane sees the event two times (1x in the personal calendar because he is also an attendee, 1x in the shared calendar)
  • Jane cannot edit the event in the shared calendar
  • Internal users see the event in the calendar
  • Users can accept/decline the event
  • 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)
  • External users receive an invitation by email
  • and can use the provided link to accept/decline

Case 2

Steps:

  1. Bob: Create event and add John and mandy@mail.internal
  2. Bob: Edit event and add Jane and kevin@mail.internal

Expected outcome:

  • Bob sees the event one time (the one in the shared calendar, there is no copy in bob's personal calendar)
  • Bob can invite internal and external attendees to the event in the shared calendar
  • and the invitations are sent by email
  • Jane sees the event two times (1x in the personal calendar because he is also an attendee, 1x in the shared calendar)
  • Jane cannot edit the event in the shared calendar
  • Internal users see the event in the calendar
  • Users can accept/decline the event
  • 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)
  • External users receive an invitation by email
  • and can use the provided link to accept/decline

@solracsf solracsf added this to the Nextcloud 30 milestone Jun 18, 2024
@kesselb kesselb removed this from the Nextcloud 30 milestone Jun 25, 2024
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
@SebastianKrupinski SebastianKrupinski force-pushed the fix/issue-26668 branch 2 times, most recently from a8b4ad7 to 83f6266 Compare July 21, 2024 17:48
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>

$calendarNode = $this->server->tree->getNodeForPath($calendarPath);

$addresses = $this->getAddressesForPrincipal($calendarNode->getOwner());

Check failure

Code scanning / Psalm

UndefinedInterfaceMethod Error

Method Sabre\DAV\INode::getOwner does not exist

$addresses = $this->getAddressesForPrincipal($calendarNode->getOwner());
// determain if this is a shared calendar
if ($calendarNode->isShared()) {

Check failure

Code scanning / Psalm

UndefinedInterfaceMethod Error

Method Sabre\DAV\INode::isShared does not exist
if ($calendarNode->isShared()) {
$addresses = array_merge(
$addresses,
$this->getAddressesForPrincipal($calendarNode->getPrincipalURI())

Check failure

Code scanning / Psalm

UndefinedInterfaceMethod Error

Method Sabre\DAV\INode::getPrincipalURI does not exist

if (!$isNew) {
$node = $this->server->tree->getNodeForPath($request->getPath());
$oldObj = Reader::read($node->get());

Check notice

Code scanning / Psalm

UndefinedInterfaceMethod Note

Method Sabre\DAV\INode::get does not exist
$oldObj = null;
}

$this->processICalendarChange($oldObj, $vCal, $addresses, [], $modified);

Check notice

Code scanning / Psalm

ArgumentTypeCoercion Note

Argument 1 of OCA\DAV\CalDAV\Schedule\Plugin::processICalendarChange expects Sabre\VObject\Component\VCalendar|null|string, but parent type Sabre\VObject\Document|null provided
@SebastianKrupinski SebastianKrupinski changed the title fix(caldav): Do not overwrite shared calendar owner fix(caldav): Add sharee to address list when calendar is shared Jul 21, 2024
@SebastianKrupinski
Copy link
Contributor Author

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.

@SebastianKrupinski
Copy link
Contributor Author

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.

@SebastianKrupinski SebastianKrupinski added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send invitations for shared calendars
4 participants