Class BlueMindShareChannel

java.lang.Object
org.exoplatform.caldav.client.bluemind.BlueMindShareChannel
All Implemented Interfaces:
CalendarShareChannel

@Service public class BlueMindShareChannel extends Object implements CalendarShareChannel
Sharing a BlueMind calendar with a colleague (EXO-90253, EXO-90277, EXO-90378): Apple's POST CS:share over DAV, every change confirmed by reading the container's access list back through BlueMind's REST API (BlueMindAclClient), and the colleague subscribed to the calendar once a grant is confirmed.

Recognised by two independent facts that must both hold: the collection advertises calendarserver-sharing in the DAV header of its PROPFIND answers (PropFindProtocol.java:125, captured in bluemind-principal.captured.xml), and it has the path BlueMind's DAV server gives every calendar, /dav/calendars/__uids__/<owner uid>/<container uid>/ (ResType.VSTUFF_CONTAINER). Apple's CalendarServer uses the same __uids__ layout without the /dav root, and Nextcloud and iCloud use other paths; those stay not offered. The share service confirms the recognition before any change: BlueMind's REST API must accept the owner's login (acceptsCredentials(org.exoplatform.caldav.client.CalDavEndpoint)), which no other server answers.

Around the protocol, because it cannot be trusted alone: the server answers 200 whatever happened, so every change is confirmed by reading the container's access list back; and the server rewrites or removes every entry of the sharee, so a sharee holding anything but a grant eXo writes is refused rather than downgraded.

A @Service, like any contribution from another add-on, so that the host collects it by type through the Kernel/Spring bridge and never names it. It logs under the share service's category, where the audit lines of every other sharing mechanism are, so that what an operator filters on does not depend on which server a calendar lives on.

  • Constructor Summary

    Constructors
    Constructor
    Description
    BlueMindShareChannel(BlueMindAclClient blueMindAclClient, CalDavClient calDavClient)
    The channel over BlueMind's access-list client and the DAV client the CS:share is posted through.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether the owner's configured credentials can open whatever session this channel reads the access list back through; the menu offers no "Share" otherwise.
    boolean
    applies(DavOptions options, String collectionHref, SharingMechanism selected)
    Takes over a collection the host selects Apple sharing for, when it advertises "calendarserver-sharing" and has BlueMind's path.
    org.exoplatform.caldav.model.CalendarShares
    grant(SharedCalendar target, ShareRecipient sharee, String ownerPrincipal, org.exoplatform.caldav.model.CalendarShares.ShareAccess access, ShareHost host)
    Gives a colleague access at the level asked for, confirmed by reading it back.
    static boolean
    isBlueMindCollection(String collectionHref)
    Whether a path is a calendar collection as BlueMind's DAV server names one.
    boolean
    mayOwn(String canonicalHref, String principal)
    BlueMind's path rule: a REST session per calendar per menu refresh would be too much, and the access list is checked when the drawer reads the sharees and before any change.
    The mechanism this channel carries, as the host reports it in its logs and answers.
    void
    Refuses an imported calendar BlueMind gives the caller no right to manage.
    org.exoplatform.caldav.model.CalendarShares
    revoke(SharedCalendar target, ShareRecipient sharee, String ownerPrincipal, ShareHost host)
    Takes a colleague's access away, confirmed by reading it back.
    org.exoplatform.caldav.model.CalendarShares
    The container's access list, the caller's right to manage it checked, as sharees.

    Methods inherited from class java.lang.Object

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

    • BlueMindShareChannel

      @Autowired public BlueMindShareChannel(BlueMindAclClient blueMindAclClient, CalDavClient calDavClient)
      The channel over BlueMind's access-list client and the DAV client the CS:share is posted through.
      Parameters:
      blueMindAclClient - reads a BlueMind calendar's access list back
      calDavClient - posts the share and reads a sharee's addresses, as the owner
  • Method Details

    • mechanism

      public SharingMechanism mechanism()
      The mechanism this channel carries, as the host reports it in its logs and answers.
      Specified by:
      mechanism in interface CalendarShareChannel
      Returns:
      an offered mechanism other than SharingMechanism.WEBDAV_ACL, which is the host's own, never null; a channel answering anything else is ignored, and so is a second channel for a mechanism an earlier one carries
    • applies

      public boolean applies(DavOptions options, String collectionHref, SharingMechanism selected)
      Takes over a collection the host selects Apple sharing for, when it advertises "calendarserver-sharing" and has BlueMind's path.
      Specified by:
      applies in interface CalendarShareChannel
      Parameters:
      options - what the collection answered
      collectionHref - the collection's path, may be null
      selected - what the host selects from the options alone
      Returns:
      true for a BlueMind calendar collection
    • acceptsCredentials

      public boolean acceptsCredentials(CalDavEndpoint endpoint)
      Whether the owner's configured credentials can open whatever session this channel reads the access list back through; the menu offers no "Share" otherwise.
      Specified by:
      acceptsCredentials in interface CalendarShareChannel
      Parameters:
      endpoint - the owner's endpoint
      Returns:
      true when they can
    • mayOwn

      public boolean mayOwn(String canonicalHref, String principal)
      BlueMind's path rule: a REST session per calendar per menu refresh would be too much, and the access list is checked when the drawer reads the sharees and before any change.
      Specified by:
      mayOwn in interface CalendarShareChannel
      Parameters:
      canonicalHref - the canonical collection href
      principal - the caller's recorded principal
      Returns:
      true when the name does not rule out the caller owning it
    • shares

      public org.exoplatform.caldav.model.CalendarShares shares(SharedCalendar target, ShareHost host)
      The container's access list, the caller's right to manage it checked, as sharees.
      Specified by:
      shares in interface CalendarShareChannel
      Parameters:
      target - the calendar
      host - what the host lends
      Returns:
      the sharees
    • requireManager

      public void requireManager(SharedCalendar target, ShareHost host)
      Refuses an imported calendar BlueMind gives the caller no right to manage.
      Specified by:
      requireManager in interface CalendarShareChannel
      Parameters:
      target - the calendar
      host - what the host lends
    • grant

      public org.exoplatform.caldav.model.CalendarShares grant(SharedCalendar target, ShareRecipient sharee, String ownerPrincipal, org.exoplatform.caldav.model.CalendarShares.ShareAccess access, ShareHost host)
      Gives a colleague access at the level asked for, confirmed by reading it back.
      Specified by:
      grant in interface CalendarShareChannel
      Parameters:
      target - the calendar, checked by the host
      sharee - the colleague, checked by the host
      ownerPrincipal - the caller's canonical principal, distinct from the sharee's
      access - CalendarShares.ShareAccess.READ or CalendarShares.ShareAccess.WRITE
      host - what the host lends the operation
      Returns:
      the sharees as read back
    • revoke

      public org.exoplatform.caldav.model.CalendarShares revoke(SharedCalendar target, ShareRecipient sharee, String ownerPrincipal, ShareHost host)
      Takes a colleague's access away, confirmed by reading it back.
      Specified by:
      revoke in interface CalendarShareChannel
      Parameters:
      target - the calendar, checked by the host
      sharee - the colleague, checked by the host
      ownerPrincipal - the caller's canonical principal, distinct from the sharee's
      host - what the host lends the operation
      Returns:
      the sharees as read back
    • isBlueMindCollection

      public static boolean isBlueMindCollection(String collectionHref)
      Whether a path is a calendar collection as BlueMind's DAV server names one.
      Parameters:
      collectionHref - the collection's path, may be null
      Returns:
      true for /dav/calendars/__uids__/<uid>/<container>/