Class CaldavCalendarShareChannelPlugin

java.lang.Object
org.exoplatform.caldav.service.CaldavCalendarShareChannelPlugin
All Implemented Interfaces:
org.exoplatform.agenda.plugin.CalendarShareChannelPlugin

@Service public class CaldavCalendarShareChannelPlugin extends Object implements org.exoplatform.agenda.plugin.CalendarShareChannelPlugin
Carries a calendar share agenda recorded onto the owner's CalDAV server (EXO-90357): the colleague's principal is granted read access to the collection the calendar is bound to, through CaldavCalendarShareService and every check it makes, and the grant is taken away when agenda revokes the share.

Agenda owns the share; this add-on delivers it

Whether a share exists is agenda's record and agenda's ACL. This plugin answers what happened on the server, and agenda keeps the record whatever the answer. A share the server has nothing to do with — the owner has no account, the calendar is not exported, the server offers no sharing eXo can confirm, the colleague has no account on that server — is the normal eXo-only case, answered as not applicable. Every other refusal of the share service is a genuine delivery failure (NOT_READ_ONLY, SERVER_UNREACHABLE, ...): agenda logs it and keeps the record undelivered; the owner is told nothing.

Channel identifiers

The plugin is one bean and answers id() caldav; a delivery is stamped caldav:<serverId> so the record says which server holds the grant, and agenda resolves the channel by that prefix.

No business logic here

Every rule — who owns what, which collection, what the server allows — is the share service's. This class resolves the owner and the colleague to logins, transfers the call, and maps the outcome onto agenda's answers.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    What id() answers, and the prefix of every delivery reference.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    channelIdOf(long serverId)
    The channel identifier of a delivery on one server: what a share record carries as deliveredTo, and what a disconnect clears by.
    org.exoplatform.agenda.model.ChannelDelivery
    deliver(org.exoplatform.agenda.model.CalendarShare share, String ownerUsername)
    Grants the colleague read access to the calendar's collection on the owner's server, as the share service does it, and answers where the grant now lives — the server and the collection — or why it could not be made.
    boolean
    holdsMeetingCopies(long calendarId, String ownerUsername)
    Whether the calendar is where this add-on writes the owner's eXo meeting copies — the mirror of a connected account — so agenda asks before sharing it.
    id()
    List<org.exoplatform.agenda.model.ExternalShare>
    listExternalShares(long calendarId, String ownerUsername, List<Long> recordedShareeIds)
    The grants the server holds on the calendar's collection that agenda has no record of, read live: a colleague granted from another client, someone outside eXo, everyone, a published link.
    org.exoplatform.agenda.model.ChannelShares
    listShares(long calendarId, String ownerUsername, List<Long> recordedShareeIds)
    Both of agenda's questions from one read of the server (EXO-90385): the grants it holds that agenda has no record of, and whether this calendar is where eXo writes the owner's meeting copies.
    boolean
    removeExternalShare(long calendarId, String externalId, String ownerUsername)
    Removes a colleague's read grant from the server: the external identifier is their login, as listExternalShares(long, java.lang.String, java.util.List<java.lang.Long>) gave it.
    boolean
    withdraw(org.exoplatform.agenda.model.CalendarShare share, String ownerUsername)
    Takes the colleague's access away on the server, whatever its level, as the share service does it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • CaldavCalendarShareChannelPlugin

      public CaldavCalendarShareChannelPlugin()
  • Method Details

    • id

      public String id()
      Specified by:
      id in interface org.exoplatform.agenda.plugin.CalendarShareChannelPlugin
    • deliver

      public org.exoplatform.agenda.model.ChannelDelivery deliver(org.exoplatform.agenda.model.CalendarShare share, String ownerUsername)
      Grants the colleague read access to the calendar's collection on the owner's server, as the share service does it, and answers where the grant now lives — the server and the collection — or why it could not be made.
      Specified by:
      deliver in interface org.exoplatform.agenda.plugin.CalendarShareChannelPlugin
      Parameters:
      share - the eXo record
      ownerUsername - the owner's login
      Returns:
      delivered with caldav:<serverId> and the collection href; not applicable when the owner has no account or the calendar is not on the server; failed with the refusal's code otherwise
    • withdraw

      public boolean withdraw(org.exoplatform.agenda.model.CalendarShare share, String ownerUsername)
      Takes the colleague's access away on the server, whatever its level, as the share service does it. A colleague who holds no grant any more changes nothing and counts as withdrawn.
      Specified by:
      withdraw in interface org.exoplatform.agenda.plugin.CalendarShareChannelPlugin
      Parameters:
      share - the eXo record this channel carried
      ownerUsername - the owner's login
      Returns:
      true when the grant is gone
    • listExternalShares

      public List<org.exoplatform.agenda.model.ExternalShare> listExternalShares(long calendarId, String ownerUsername, List<Long> recordedShareeIds)
      The grants the server holds on the calendar's collection that agenda has no record of, read live: a colleague granted from another client, someone outside eXo, everyone, a published link. A colleague agenda already holds a record for is left out. A colleague's plain read grant carries the collection href as its delivery reference: agenda records it as an adopted share, silently, the moment the owner lists their shares.

      Only a colleague's plain read grant can be removed from here, since the share service revokes by login; any other grant is listed as it is, for the owner to manage where it was set.

      Specified by:
      listExternalShares in interface org.exoplatform.agenda.plugin.CalendarShareChannelPlugin
      Parameters:
      calendarId - the agenda calendar
      ownerUsername - the owner's login
      recordedShareeIds - the colleagues agenda already holds a record for
      Returns:
      the external shares, empty when the calendar is not on the server, the owner has no account, or the list cannot be read
    • listShares

      public org.exoplatform.agenda.model.ChannelShares listShares(long calendarId, String ownerUsername, List<Long> recordedShareeIds)
      Both of agenda's questions from one read of the server (EXO-90385): the grants it holds that agenda has no record of, and whether this calendar is where eXo writes the owner's meeting copies.

      The flag is not asked for: CaldavCalendarShareService.serverShares(long, java.lang.String, long) already carries it on the shares it answers, because the same resolution of the calendar produces it. Asked on its own — as agenda did before this method existed — it cost the owner's request a second walk of their calendar home, which on a remote server is seconds.

      When the server's list cannot be read the flag is still owed, and is asked on its own, as it was before: an unreadable access list must not silently turn the warning off, since a missed warning exposes the owner's meetings while a false one costs a click.

      Specified by:
      listShares in interface org.exoplatform.agenda.plugin.CalendarShareChannelPlugin
      Parameters:
      calendarId - the agenda calendar
      ownerUsername - the owner's login
      recordedShareeIds - the colleagues agenda already holds a record for
      Returns:
      the external shares and the meeting-copies flag
    • removeExternalShare

      public boolean removeExternalShare(long calendarId, String externalId, String ownerUsername)
      Removes a colleague's read grant from the server: the external identifier is their login, as listExternalShares(long, java.lang.String, java.util.List<java.lang.Long>) gave it.
      Specified by:
      removeExternalShare in interface org.exoplatform.agenda.plugin.CalendarShareChannelPlugin
      Parameters:
      calendarId - the agenda calendar
      externalId - the colleague's login
      ownerUsername - the owner's login
      Returns:
      true when removed
    • holdsMeetingCopies

      public boolean holdsMeetingCopies(long calendarId, String ownerUsername)
      Whether the calendar is where this add-on writes the owner's eXo meeting copies — the mirror of a connected account — so agenda asks before sharing it.
      Specified by:
      holdsMeetingCopies in interface org.exoplatform.agenda.plugin.CalendarShareChannelPlugin
      Parameters:
      calendarId - the agenda calendar
      ownerUsername - the owner's login
      Returns:
      true when the calendar receives the meeting copies; false when it does not, is not on the server, or cannot be told
    • channelIdOf

      public static String channelIdOf(long serverId)
      The channel identifier of a delivery on one server: what a share record carries as deliveredTo, and what a disconnect clears by.
      Parameters:
      serverId - the server key
      Returns:
      caldav:<serverId>