Class BlueMindShareChannel

java.lang.Object
org.exoplatform.bluemind.calendar.plugin.BlueMindShareChannel
All Implemented Interfaces:
org.exoplatform.caldav.plugin.CalendarShareChannel, org.springframework.core.Ordered

@Service("blueMindAddonShareChannel") @ConditionalOnClass(org.exoplatform.caldav.plugin.CalendarShareChannel.class) public class BlueMindShareChannel extends Object implements org.exoplatform.caldav.plugin.CalendarShareChannel, org.springframework.core.Ordered
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; named "blueMindAddonShareChannel" and ordered BlueMindCalendarPrecedence.ORDER, since the host keeps the first channel that applies to a collection and still ships its own for BlueMind. It logs under the host's 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, nor on which add-on shares it.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The bean name, distinct from the host's own channel's.

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    BlueMindShareChannel(BlueMindAclClient blueMindAclClient, org.exoplatform.caldav.client.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
    acceptsCredentials(org.exoplatform.caldav.client.CalDavEndpoint endpoint)
    boolean
    applies(org.exoplatform.caldav.client.DavOptions options, String collectionHref, org.exoplatform.caldav.client.SharingMechanism selected)
    Takes over a collection the host selects Apple sharing for, when it advertises "calendarserver-sharing" and has BlueMind's path.
    int
    Ahead of the host's own BlueMind channel.
    org.exoplatform.caldav.model.CalendarShares
    grant(org.exoplatform.caldav.plugin.SharedCalendar target, org.exoplatform.caldav.plugin.ShareRecipient sharee, String ownerPrincipal, org.exoplatform.caldav.model.CalendarShares.ShareAccess access, org.exoplatform.caldav.plugin.ShareHost host)
    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.
    org.exoplatform.caldav.client.SharingMechanism
    void
    requireManager(org.exoplatform.caldav.plugin.SharedCalendar target, org.exoplatform.caldav.plugin.ShareHost host)
    Refuses an imported calendar BlueMind gives the caller no right to manage.
    org.exoplatform.caldav.model.CalendarShares
    revoke(org.exoplatform.caldav.plugin.SharedCalendar target, org.exoplatform.caldav.plugin.ShareRecipient sharee, String ownerPrincipal, org.exoplatform.caldav.plugin.ShareHost host)
    org.exoplatform.caldav.model.CalendarShares
    shares(org.exoplatform.caldav.plugin.SharedCalendar target, org.exoplatform.caldav.plugin.ShareHost host)
    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
  • Field Details

    • BEAN_NAME

      public static final String BEAN_NAME
      The bean name, distinct from the host's own channel's.
      See Also:
  • Constructor Details

    • BlueMindShareChannel

      @Autowired public BlueMindShareChannel(BlueMindAclClient blueMindAclClient, org.exoplatform.caldav.client.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 org.exoplatform.caldav.client.SharingMechanism mechanism()
      Specified by:
      mechanism in interface org.exoplatform.caldav.plugin.CalendarShareChannel
    • applies

      public boolean applies(org.exoplatform.caldav.client.DavOptions options, String collectionHref, org.exoplatform.caldav.client.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 org.exoplatform.caldav.plugin.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(org.exoplatform.caldav.client.CalDavEndpoint endpoint)
      Specified by:
      acceptsCredentials in interface org.exoplatform.caldav.plugin.CalendarShareChannel
    • 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 org.exoplatform.caldav.plugin.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(org.exoplatform.caldav.plugin.SharedCalendar target, org.exoplatform.caldav.plugin.ShareHost host)
      The container's access list, the caller's right to manage it checked, as sharees.
      Specified by:
      shares in interface org.exoplatform.caldav.plugin.CalendarShareChannel
      Parameters:
      target - the calendar
      host - what the host lends
      Returns:
      the sharees
    • requireManager

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

      public org.exoplatform.caldav.model.CalendarShares grant(org.exoplatform.caldav.plugin.SharedCalendar target, org.exoplatform.caldav.plugin.ShareRecipient sharee, String ownerPrincipal, org.exoplatform.caldav.model.CalendarShares.ShareAccess access, org.exoplatform.caldav.plugin.ShareHost host)
      Specified by:
      grant in interface org.exoplatform.caldav.plugin.CalendarShareChannel
    • revoke

      public org.exoplatform.caldav.model.CalendarShares revoke(org.exoplatform.caldav.plugin.SharedCalendar target, org.exoplatform.caldav.plugin.ShareRecipient sharee, String ownerPrincipal, org.exoplatform.caldav.plugin.ShareHost host)
      Specified by:
      revoke in interface org.exoplatform.caldav.plugin.CalendarShareChannel
    • getOrder

      public int getOrder()
      Ahead of the host's own BlueMind channel.
      Specified by:
      getOrder in interface org.springframework.core.Ordered
      Returns:
      BlueMindCalendarPrecedence.ORDER
    • 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>/