Class BlueMindAclEngine

java.lang.Object
org.exoplatform.bluemind.mail.plugin.BlueMindAclEngine
All Implemented Interfaces:
org.exoplatform.emailConnector.service.acl.MailboxAclEngine, org.springframework.core.Ordered

@Service("blueMindAddonAclEngine") @ConditionalOnClass(org.exoplatform.emailConnector.service.acl.MailboxAclEngine.class) public class BlueMindAclEngine extends Object implements org.exoplatform.emailConnector.service.acl.MailboxAclEngine, org.springframework.core.Ordered
The mailbox-sharing engine of a BlueMind server, selected by email.connector.aclEngine[.<connectorId>]=bluemind. BlueMind's proxy in front of the mailstore drops IMAP SETACL (it answers * ALERT Missing analyzer), so every write goes over BlueMind's REST API, as the caller, through the one BlueMind port BlueMindMailboxTransport; the reads the proxy lets through stay on IMAP, where the delegate's mail is synchronised from.

Contributed from the add-on's web application, as BlueMindRuleEngine is: a @Service named "blueMindAddonAclEngine", never final, ordered ORDER, guarded by the host's SPI, and taking nothing private to the host. Without the add-on's transport it is still registered and its probe answers unsupported.

What goes where.

  • The owner's side over REST, on the owner's own session: a folder's list is GET _acl of the folder's records container mbox_records_<folder uid>, the uid read from the owner's folder listing by the folder's name, and its grant and removal a read-modify-write of it (PUT _acl); the whole mailbox's list is GET _acls of the login's own mailbox, written the same way (POST _acls). The owner's folders and their roles are BlueMind's own listing. The grantee is resolved by address through directory/_byEmail, the one lookup an ordinary user's session was seen to pass; an entry the directory does not know, or a route the deployment's proxy filters, fails closed and a uid is never guessed from an address.
  • The grantee's side on the grantee's own session. Which mailboxes are shared with the grantee is BlueMind's answer over REST: the grantee's mailboxacl subscriptions, the grantee's own mailbox aside, one shared mailbox each -- never the folders of the IMAP listing, which shows a shared mailbox's folders as well as its root. Where each one is, and MYRIGHTS and the folders under it, are IMAP's (ImapAclEngine), because those names are the ones the delegate's synchronisation selects: a shared mailbox's root is the listed folder whose full name is the namespace's prefix and the owner's login (Autres utilisateurs/anais.francois).
  • The acceptance over REST, on the grantee's own session: a subscription to mailbox:acls-<ownerUid>, what BlueMind's own clients hold for a mailbox, after checking that the session is the account of the grantee's recorded address.

Verbs, not letters. A Reader is written Read and an Editor Write; a list is read in its compact form (BlueMindAcls), so a share made in BlueMind's interface reads as the same preset as one made from eXo, and anything holding more (Manage, All, ReadExtended) is custom, shown raw.

Per folder, and per mailbox beside it. eXo shares folder by folder, as on an RFC 4314 server (GrantGranularity.FOLDER), on each folder's own list -- the list BlueMind's own "share this folder" writes. BlueMind also keeps a list for the whole mailbox, and the two add up: a folder's entry adds to a whole-mailbox entry and never narrows it. So the capability says mailboxScope; a folder's list is read with the whole mailbox's entries merged in, each subject once, its scope AclScope.MAILBOX when it holds the whole mailbox; a whole-mailbox entry is written and removed only by grantWholeMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String, org.exoplatform.emailConnector.model.DelegationPreset, org.exoplatform.emailConnector.model.MailboxRights) and revokeWholeMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String); and a folder write the whole-mailbox entry would contradict -- a narrower access, a removal -- is refused rather than reported done. A Reader is Read and an Editor Write on every folder, the owner's Trash included (EDITOR_VERB_ON_TRASH). The owner's own rows, which BlueMind lists under the owner's uid, are never a share. Nor is a subject holding Visible alone: BlueMind writes it on the mailbox's list while one of the owner's folders is shared with that subject in its interface, and puts it back when a removal takes it away from them. It is the footprint of a folder share: never listed, never a reason for a removal to write, and no failure when a removal reads it back.

The write, with no version to compare. POST _acls replaces the whole list and BlueMind offers no ETag. A grant or a removal reads the list, changes the grantee's rows only, writes the whole list back as it was read (the owner's rows included, as verified live), and reads it again: the grantee's compact set must be the one intended, and every other subject's verbs unchanged, or the write is reported, never retried. The read and the write are made back to back, but an edit made in BlueMind's interface between them is overwritten, and the read-back cannot see it: the window is the round trip, not zero. Two eXo writes to one owner's list on one node are serialised; on two nodes they are not, and the later write wins. A list that does not name the owner is never written back, so a list read in an unexpected shape cannot take the owner's own rights away.

Writing in the owner's name. The owner's consent is written on the grantee's rows of the whole mailbox's list, beside the access verb, in the same read-modify-write: beside a whole-mailbox share, or, for a grantee holding folders only, beside the Visible footprint those folder shares keep there -- BlueMind's milter asks exactly the send verbs held on that list (DelegationAction), whatever access goes with them. A consent on that footprint is no whole-mailbox share (BlueMindAcls.wholeShareOf(java.util.Collection<java.lang.String>)). The verbs: SendOnBehalf for on behalf, SendAs alone for as the owner (BlueMind reads it back with SendOnBehalf, which it implies), and neither once it is withdrawn. A consent changed from one way to the other replaces the send verb, and a consent the grantee already holds writes nothing; withdrawing it keeps the access. A whole-mailbox grant replaces every row of the grantee there, send verbs included, as the SPI asks ("replaced, not widened"), and a folder's grant never touches them: the engine cannot tell a changed preset from a share offered again after the grantee declined or left, when eXo no longer records a consent, so it never carries a send verb into a grant. A consent the host still records after a preset change is on the server again only once the owner sets it again (grantSendMode(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String, org.exoplatform.emailConnector.model.SendMode)); until then the server holds none. The host takes a consent off the server when the owner withdraws it (revokeSendMode(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String)) or removes the grantee: its removal of a share runs revokeWholeMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String) first, which takes the grantee's every row off the mailbox's list, a consent beside folder shares with its Visible footprint (BlueMind writes the footprint back while a folder share stands). One eXo clears because the grantee declined or left stays on the server until the owner's next grant or removal of that grantee. A send verb set in BlueMind's own interface is read as it stands and goes with any grant or removal made from eXo.

Whose mailbox. Every write, and every subscription, first checks that the directory gives the session's own uid for the caller's recorded address: a login that is another account's never acts on a mailbox eXo does not record.

What the server does itself. BlueMind e-mails the owner on every rights change (serverNotifiesOwner()). Removing the grantee's rows does not withdraw the grantee's subscription: the owner's session cannot act on the grantee's, and nothing in eXo withdraws it after a removal -- the grantee's leave applies to a share in use only -- so the grantee's own BlueMind client must.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The bean name, distinct from any name scanning gives a host bean.
    static final String
    The engine name a preset selects.
    static final int
    Ahead of every engine that states no order: the add-on's one precedence.

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    The engine over a transport.
    BlueMindAclEngine(org.springframework.beans.factory.ObjectProvider<BlueMindMailboxTransport> transports)
    The engine over the add-on's transport, when there is one.
  • Method Summary

    Modifier and Type
    Method
    Description
    Map<org.exoplatform.emailConnector.model.FolderRole,String>
    findRoleFolders(org.exoplatform.emailConnector.service.acl.MailboxAclSession session)
    The owner's folders by role, from BlueMind's own listing: its default folders keep fixed English names (Sent, Trash, Junk, Drafts) at the top level, and BlueMind makes no Archive -- a top-level folder of the owner's whose name is an archive's usual name (FolderRole.ofUsualName(java.lang.String)) is the Archive.
    org.exoplatform.emailConnector.model.SharedMailbox
    findSharedMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String ownerIdentifier)
    One owner's mailbox among those shared with the caller, by the same rule as listSharedMailboxes(org.exoplatform.emailConnector.service.acl.MailboxAclSession): an owner known by address is the directory's uid for that address, an owner known by login the owner of the caller's subscription of that name, and either is found only among the caller's subscriptions -- never by a guess from an address's local part or from a folder's name.
    foldersHolding(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String identifier)
    The owner's folders whose own list gives the grantee a share, from one call that lists every shared folder (_shared), each named by the owner's folder listing; a shared container the listing does not name is left out.
    The engine's name.
    int
    Where the registry sorts this engine among those it collects.
    org.exoplatform.emailConnector.model.MailboxAce
    grant(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String mailbox, String identifier, org.exoplatform.emailConnector.model.DelegationPreset preset, org.exoplatform.emailConnector.model.MailboxRights ownerRights)
    grant(MailboxAclSession, String, String, DelegationPreset, MailboxRights, FolderRole) on a folder of no role: INBOX, or a folder of the owner's own making.
    org.exoplatform.emailConnector.model.MailboxAce
    grant(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String mailbox, String identifier, org.exoplatform.emailConnector.model.DelegationPreset preset, org.exoplatform.emailConnector.model.MailboxRights ownerRights, org.exoplatform.emailConnector.model.FolderRole role)
    Grants a preset to one grantee on one of the owner's folders: the grantee's rows on the folder's own list replaced by the preset's one verb for the folder's role (verbFor(org.exoplatform.emailConnector.model.DelegationPreset, org.exoplatform.emailConnector.model.FolderRole)), capped by the owner's own letters there (an Editor the owner cannot cover is written a Reader, a Reader the owner cannot cover nothing), in a read-modify-write of that list that changes the grantee's rows only.
    void
    grantSendMode(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String identifier, org.exoplatform.emailConnector.model.SendMode mode)
    Writes the owner's consent to one grantee writing mail in her name: SendOnBehalf for SendMode.ON_BEHALF, SendAs for SendMode.AS, in place of the send verb the grantee held, beside the grantee's access, which stays as it is.
    org.exoplatform.emailConnector.model.MailboxAce
    grantWholeMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String identifier, org.exoplatform.emailConnector.model.DelegationPreset preset, org.exoplatform.emailConnector.model.MailboxRights ownerRights)
    Grants a preset to one grantee on the owner's whole mailbox: the grantee's access on the mailbox's list replaced by the preset's one verb (Read, Write), capped by the owner's own letters on INBOX, in a read-modify-write of the list that changes the grantee's rows only.
    org.exoplatform.emailConnector.model.MailboxRights
    lettersFor(org.exoplatform.emailConnector.model.DelegationPreset preset, org.exoplatform.emailConnector.model.FolderRole role)
    The letters a preset stands for on a folder of a role: what its verb (verbFor(org.exoplatform.emailConnector.model.DelegationPreset, org.exoplatform.emailConnector.model.FolderRole)) pushes, lrp for Read and lrswipkxte for Write.
    List<org.exoplatform.emailConnector.model.MailboxAce>
    listAcl(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String mailbox)
    Who holds which verbs on one of the owner's folders, over REST: the folder's own list merged with the whole mailbox's, each subject once, the owner's own rows left out, and a subject holding Visible alone on the mailbox -- the footprint a folder share leaves there (BlueMindAcls.wholeShareOf(java.util.Collection<java.lang.String>)), with or without a send verb -- held as no whole-mailbox share.
    Map<String,List<org.exoplatform.emailConnector.model.MailboxAce>>
    listAcls(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, List<String> folders)
    Several of the owner's folders' lists at once, in one session and a fixed number of requests whatever the number of folders: the owner's folder listing, the whole mailbox's list, and every shared folder's rows from one _shared call (as stored: compact, the owner left out), each merged as listAcl(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String) merges them, and one directory lookup per subject.
    List<org.exoplatform.emailConnector.model.DiscoveredFolder>
    listFoldersUnder(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String root, String delimiter)
    The folders of a shared mailbox, over IMAP.
    List<org.exoplatform.emailConnector.model.OwnFolder>
    listOwnFolders(org.exoplatform.emailConnector.service.acl.MailboxAclSession session)
    The owner's own folders, from BlueMind's own listing, each with its role (findRoleFolders(org.exoplatform.emailConnector.service.acl.MailboxAclSession)), INBOX included; BlueMind's Templates and Outbox are never offered.
    List<org.exoplatform.emailConnector.model.SharedMailbox>
    listSharedMailboxes(org.exoplatform.emailConnector.service.acl.MailboxAclSession session)
    The mailboxes shared with the caller: one per mailbox the caller is subscribed to on BlueMind (mailboxacl subscriptions, the caller's own aside), never one per folder of the caller's IMAP listing.
    org.exoplatform.emailConnector.model.MailboxRights
    myRights(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String mailbox)
    The caller's rights on one mailbox, over IMAP (MYRIGHTS passes BlueMind's proxy).
    org.exoplatform.emailConnector.model.DelegationPreset
    presetOf(org.exoplatform.emailConnector.model.MailboxRights rights)
    The preset a delegate's own IMAP letters are on BlueMind: lrp (what Read pushes) a Reader, lrswipkxte (what Write pushes) an Editor, else the plain IMAP reading.
    org.exoplatform.emailConnector.model.MailboxAclCapabilities
    probe(org.exoplatform.emailConnector.service.acl.MailboxAclSession session)
    What the server can do, decided by attempting it: a login as the caller and a read of the caller's own mailbox's list.
    void
    revoke(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String mailbox, String identifier)
    Removes one grantee's rows from one of the owner's folders, in a read-modify-write of that folder's list; nothing is written when the list names no share of the grantee, or the owner's listing no longer holds the folder.
    void
    revokeSendMode(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String identifier)
    Takes the owner's consent to one grantee writing mail in her name off the list: both send verbs removed, the grantee's access kept as it is.
    void
    revokeWholeMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String identifier)
    Removes every row of one grantee from the owner's whole mailbox's list, send verbs included, in a read-modify-write of it.
    boolean
    BlueMind e-mails the owner on every rights change.
    void
    subscribe(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String ownerIdentifier)
    Accepts a share on BlueMind: subscribes the caller to the owner's mailbox, as BlueMind's own clients hold it, once the caller's session is checked to be the account of the caller's recorded address.
    void
    unsubscribe(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String ownerIdentifier)
    Withdraws the caller's subscription to the owner's mailbox, once the caller's session is checked as subscribe(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String) checks it.

    Methods inherited from class java.lang.Object

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

    • NAME

      public static final String NAME
      The engine name a preset selects.
      See Also:
    • BEAN_NAME

      public static final String BEAN_NAME
      The bean name, distinct from any name scanning gives a host bean.
      See Also:
    • ORDER

      public static final int ORDER
      Ahead of every engine that states no order: the add-on's one precedence.
      See Also:
  • Constructor Details

    • BlueMindAclEngine

      @Autowired public BlueMindAclEngine(org.springframework.beans.factory.ObjectProvider<BlueMindMailboxTransport> transports)
      The engine over the add-on's transport, when there is one.
      Parameters:
      transports - the add-on's transport, possibly absent
    • BlueMindAclEngine

      public BlueMindAclEngine(Supplier<BlueMindMailboxTransport> transport)
      The engine over a transport.
      Parameters:
      transport - supplies the transport, or null when there is none
  • Method Details

    • getName

      public String getName()
      The engine's name.
      Specified by:
      getName in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Returns:
      "bluemind"
    • getOrder

      public int getOrder()
      Where the registry sorts this engine among those it collects.
      Specified by:
      getOrder in interface org.springframework.core.Ordered
      Returns:
      ORDER
    • probe

      public org.exoplatform.emailConnector.model.MailboxAclCapabilities probe(org.exoplatform.emailConnector.service.acl.MailboxAclSession session)
      What the server can do, decided by attempting it: a login as the caller and a read of the caller's own mailbox's list. Every failure answers unsupported with its code: no transport or no server is unsupported.provider, no material or a server that cannot be reached unreachable, a server that refuses the read unsupported.
      Specified by:
      probe in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the caller's own session
      Returns:
      the capabilities, never null
    • myRights

      public org.exoplatform.emailConnector.model.MailboxRights myRights(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String mailbox)
      The caller's rights on one mailbox, over IMAP (MYRIGHTS passes BlueMind's proxy).
      Specified by:
      myRights in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the caller's own session
      mailbox - the mailbox's full name
      Returns:
      the rights
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - when the server refuses or cannot be asked
    • listAcl

      public List<org.exoplatform.emailConnector.model.MailboxAce> listAcl(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String mailbox)
      Who holds which verbs on one of the owner's folders, over REST: the folder's own list merged with the whole mailbox's, each subject once, the owner's own rows left out, and a subject holding Visible alone on the mailbox -- the footprint a folder share leaves there (BlueMindAcls.wholeShareOf(java.util.Collection<java.lang.String>)), with or without a send verb -- held as no whole-mailbox share. A subject holding the whole mailbox is listed at AclScope.MAILBOX with the verbs of both lists, which add up; one holding the folder alone at AclScope.FOLDER. Each subject is named by its directory address when the directory gives one, else by its uid; its letters, native form and preset are read from its compact verb set. One directory lookup per subject listed, one after the other: a list of N subjects costs N + 3 requests (the folder listing and both lists), as the directory offers no batched read verified on an ordinary user's session. A lookup that fails fails the list, rather than naming a subject the host could not match to its record.
      Specified by:
      listAcl in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      mailbox - the folder's full name, INBOX matched ignoring case
      Returns:
      the entries, the whole mailbox's subjects first, in BlueMind's order
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - serverRefused for a folder the owner's listing does not hold, and when the server refuses or cannot be asked
    • listAcls

      public Map<String,List<org.exoplatform.emailConnector.model.MailboxAce>> listAcls(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, List<String> folders)
      Several of the owner's folders' lists at once, in one session and a fixed number of requests whatever the number of folders: the owner's folder listing, the whole mailbox's list, and every shared folder's rows from one _shared call (as stored: compact, the owner left out), each merged as listAcl(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String) merges them, and one directory lookup per subject. A folder no share names lists the whole mailbox's subjects only; a folder the owner's listing does not hold is left out of the answer.
      Specified by:
      listAcls in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      folders - the folders' full names
      Returns:
      each folder's entries, by full name, in the order asked
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - when the server refuses or cannot be asked
    • grant

      public org.exoplatform.emailConnector.model.MailboxAce grant(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String mailbox, String identifier, org.exoplatform.emailConnector.model.DelegationPreset preset, org.exoplatform.emailConnector.model.MailboxRights ownerRights)
      grant(MailboxAclSession, String, String, DelegationPreset, MailboxRights, FolderRole) on a folder of no role: INBOX, or a folder of the owner's own making.
      Specified by:
      grant in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      mailbox - the folder's full name
      identifier - the grantee's address
      preset - READER or EDITOR
      ownerRights - the owner's own letters on that folder
      Returns:
      the grantee's entry on the folder as written
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - as the role's grant
    • grant

      public org.exoplatform.emailConnector.model.MailboxAce grant(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String mailbox, String identifier, org.exoplatform.emailConnector.model.DelegationPreset preset, org.exoplatform.emailConnector.model.MailboxRights ownerRights, org.exoplatform.emailConnector.model.FolderRole role)
      Grants a preset to one grantee on one of the owner's folders: the grantee's rows on the folder's own list replaced by the preset's one verb for the folder's role (verbFor(org.exoplatform.emailConnector.model.DelegationPreset, org.exoplatform.emailConnector.model.FolderRole)), capped by the owner's own letters there (an Editor the owner cannot cover is written a Reader, a Reader the owner cannot cover nothing), in a read-modify-write of that list that changes the grantee's rows only. Refused before anything is written when the grantee's whole-mailbox entry gives more than the verb: the folder would keep that access, whatever its own list says.
      Specified by:
      grant in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      mailbox - the folder's full name, INBOX matched ignoring case
      identifier - the grantee's address
      preset - READER or EDITOR
      ownerRights - the owner's own letters on that folder
      role - the folder's role, null for INBOX and the owner's own folders
      Returns:
      the grantee's entry on the folder as written
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - nothingToGrant when nothing is left to grant or the grantee is the owner, serverRefused for a folder the owner's listing does not hold, a grantee the directory does not give, a whole-mailbox entry that gives more, or a list that changed under the write, notRecorded when the list does not hold the grant afterwards
    • grantWholeMailbox

      public org.exoplatform.emailConnector.model.MailboxAce grantWholeMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String identifier, org.exoplatform.emailConnector.model.DelegationPreset preset, org.exoplatform.emailConnector.model.MailboxRights ownerRights)
      Grants a preset to one grantee on the owner's whole mailbox: the grantee's access on the mailbox's list replaced by the preset's one verb (Read, Write), capped by the owner's own letters on INBOX, in a read-modify-write of the list that changes the grantee's rows only. A send verb the grantee holds goes with the rows it replaces: a grant never carries a consent to writing in the owner's name, which only grantSendMode(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String, org.exoplatform.emailConnector.model.SendMode) writes.
      Specified by:
      grantWholeMailbox in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      identifier - the grantee's address
      preset - READER or EDITOR
      ownerRights - the owner's own letters on INBOX
      Returns:
      the grantee's whole-mailbox entry as the list holds it after the write
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - nothingToGrant when nothing is left to grant or the grantee is the owner, serverRefused for a grantee the directory does not give, or a list that changed under the write, notRecorded when the list does not hold the grant afterwards
    • grantSendMode

      public void grantSendMode(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String identifier, org.exoplatform.emailConnector.model.SendMode mode)
      Writes the owner's consent to one grantee writing mail in her name: SendOnBehalf for SendMode.ON_BEHALF, SendAs for SendMode.AS, in place of the send verb the grantee held, beside the grantee's access, which stays as it is. The grantee is resolved by address, as a grant resolves them, and must hold a share: a whole-mailbox share on the list, or one of the owner's folders (_shared), whose Visible footprint on the list the consent then sits beside, the footprint written with it when the list does not carry it. A consent is never a share of its own. Nothing is written when the grantee holds that consent already.
      Specified by:
      grantSendMode in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      identifier - the grantee's address
      mode - ON_BEHALF or AS
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - serverRefused for another mode, an identifier that is not an address, a grantee the directory does not give or who is the owner, a grantee holding neither a whole-mailbox share nor a folder share, or a list that changed under the write; notRecorded when the list does not hold the consent afterwards
    • revokeSendMode

      public void revokeSendMode(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String identifier)
      Takes the owner's consent to one grantee writing mail in her name off the list: both send verbs removed, the grantee's access kept as it is. Nothing is written when the grantee holds neither, or the list names no row of them; the grantee is named as revoke(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String, java.lang.String) names them.
      Specified by:
      revokeSendMode in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      identifier - the grantee's address, or the uid the list names them by
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - serverRefused for a blank identifier, the owner's own uid, a directory that cannot be asked, a grantee whose access implies sending (All, set in BlueMind's own interface), or a list that changed under the write; notRecorded when the list still holds a send verb of the grantee afterwards
    • revoke

      public void revoke(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String mailbox, String identifier)
      Removes one grantee's rows from one of the owner's folders, in a read-modify-write of that folder's list; nothing is written when the list names no share of the grantee, or the owner's listing no longer holds the folder. The grantee's whole-mailbox entry is never touched here (revokeWholeMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String)): when they hold one, the folder stays theirs through it, and the removal is refused after the folder's own rows are gone, rather than reported done. A consent beside folder shares is not touched here either: revokeWholeMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String) takes it off.
      Specified by:
      revoke in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      mailbox - the folder's full name, INBOX matched ignoring case
      identifier - the grantee's address, or the uid the list names them by
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - serverRefused for a blank identifier, the owner's own uid, a directory that cannot be asked, a list that changed under the write, or a grantee who keeps the folder through the whole mailbox; notRecorded when the folder's list still holds a share of the grantee
    • revokeWholeMailbox

      public void revokeWholeMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String identifier)
      Removes every row of one grantee from the owner's whole mailbox's list, send verbs included, in a read-modify-write of it. Nothing is written when the list names no share of the grantee: no row, or Visible alone, the footprint of a folder share, which BlueMind keeps for as long as a folder of the owner's is shared with the grantee. A removal BlueMind answers with that footprint put back is recorded (checkWritten(java.util.List<org.exoplatform.bluemind.client.model.BlueMindAclEntry>, java.util.List<org.exoplatform.bluemind.client.model.BlueMindAclEntry>, java.lang.String, java.util.Set<java.lang.String>)). A consent to writing in the owner's name beside the footprint is rows to remove here, the footprint with it: the host's removal of a grantee runs this first, and it is how a consent beside folder shares leaves the server, so the test is BlueMindAcls.shareOf(java.util.Collection<java.lang.String>), never BlueMindAcls.wholeShareOf(java.util.Collection<java.lang.String>). The grantee's folder rows are left to revoke(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String, java.lang.String).
      Specified by:
      revokeWholeMailbox in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      identifier - the grantee's address, or the uid the list names them by
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - serverRefused for a blank identifier, the owner's own uid, a directory that cannot be asked, or a list that changed under the write; notRecorded when the list still holds a share of the grantee
    • findRoleFolders

      public Map<org.exoplatform.emailConnector.model.FolderRole,String> findRoleFolders(org.exoplatform.emailConnector.service.acl.MailboxAclSession session)
      The owner's folders by role, from BlueMind's own listing: its default folders keep fixed English names (Sent, Trash, Junk, Drafts) at the top level, and BlueMind makes no Archive -- a top-level folder of the owner's whose name is an archive's usual name (FolderRole.ofUsualName(java.lang.String)) is the Archive. The first folder found for a role keeps it.
      Specified by:
      findRoleFolders in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      Returns:
      the folder full name of each role found, never null
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - when the server refuses or cannot be asked
    • listOwnFolders

      public List<org.exoplatform.emailConnector.model.OwnFolder> listOwnFolders(org.exoplatform.emailConnector.service.acl.MailboxAclSession session)
      The owner's own folders, from BlueMind's own listing, each with its role (findRoleFolders(org.exoplatform.emailConnector.service.acl.MailboxAclSession)), INBOX included; BlueMind's Templates and Outbox are never offered. The names are the full names the listing gives, / between levels -- the names the owner's IMAP session shows and the folder's list is found by.
      Specified by:
      listOwnFolders in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      Returns:
      the folders, in BlueMind's order
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - when the server refuses or cannot be asked
    • foldersHolding

      public List<String> foldersHolding(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String identifier)
      The owner's folders whose own list gives the grantee a share, from one call that lists every shared folder (_shared), each named by the owner's folder listing; a shared container the listing does not name is left out. INBOX is among them when shared; the whole mailbox's list is not a folder's.
      Specified by:
      foldersHolding in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the owner's own session
      identifier - the grantee's address, or the uid the list names them by
      Returns:
      the folder full names, possibly empty, never null
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - when the server refuses or cannot be asked
    • lettersFor

      public org.exoplatform.emailConnector.model.MailboxRights lettersFor(org.exoplatform.emailConnector.model.DelegationPreset preset, org.exoplatform.emailConnector.model.FolderRole role)
      The letters a preset stands for on a folder of a role: what its verb (verbFor(org.exoplatform.emailConnector.model.DelegationPreset, org.exoplatform.emailConnector.model.FolderRole)) pushes, lrp for Read and lrswipkxte for Write. BlueMind's levels are coarse: an Editor holds e wherever it holds Write.
      Specified by:
      lettersFor in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      preset - READER or EDITOR
      role - the folder's role, null for INBOX and the owner's own folders
      Returns:
      the letters, before any cap; none for a preset not granted
    • listSharedMailboxes

      public List<org.exoplatform.emailConnector.model.SharedMailbox> listSharedMailboxes(org.exoplatform.emailConnector.service.acl.MailboxAclSession session)
      The mailboxes shared with the caller: one per mailbox the caller is subscribed to on BlueMind (mailboxacl subscriptions, the caller's own aside), never one per folder of the caller's IMAP listing. IMAP only says where each such mailbox is: its root under the Other Users namespace, named by the owner's login (the subscription's name), and its INBOX -- the names the delegate's synchronisation selects (rootOf(java.util.List<org.exoplatform.emailConnector.model.SharedMailbox>, java.util.List<java.lang.String>, java.lang.String)). An owner is named by its directory address, else by its login. A subscription whose root the listing does not show is left out, told at WARN once per connector and login.

      Fails closed: when BlueMind cannot be asked, the call fails, and nothing is answered from the IMAP listing alone. The host then keeps its rows as they are, where an empty list would end every share in use.

      Specified by:
      listSharedMailboxes in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the grantee's own session
      Returns:
      the shared mailboxes, in BlueMind's subscription order
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - when BlueMind cannot be asked or refuses, or the server refuses the IMAP listing
    • findSharedMailbox

      public org.exoplatform.emailConnector.model.SharedMailbox findSharedMailbox(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String ownerIdentifier)
      One owner's mailbox among those shared with the caller, by the same rule as listSharedMailboxes(org.exoplatform.emailConnector.service.acl.MailboxAclSession): an owner known by address is the directory's uid for that address, an owner known by login the owner of the caller's subscription of that name, and either is found only among the caller's subscriptions -- never by a guess from an address's local part or from a folder's name.
      Specified by:
      findSharedMailbox in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the grantee's own session
      ownerIdentifier - the owner's address, or login
      Returns:
      the shared mailbox, or null when BlueMind knows no such owner or the caller holds no subscription to it whose root IMAP shows
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - when BlueMind cannot be asked or refuses, or the server refuses the IMAP listing
    • listFoldersUnder

      public List<org.exoplatform.emailConnector.model.DiscoveredFolder> listFoldersUnder(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String root, String delimiter)
      The folders of a shared mailbox, over IMAP.
      Specified by:
      listFoldersUnder in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the grantee's own session
      root - the shared mailbox's root
      delimiter - the hierarchy delimiter
      Returns:
      the folders
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - when the server refuses or cannot be reached
    • presetOf

      public org.exoplatform.emailConnector.model.DelegationPreset presetOf(org.exoplatform.emailConnector.model.MailboxRights rights)
      The preset a delegate's own IMAP letters are on BlueMind: lrp (what Read pushes) a Reader, lrswipkxte (what Write pushes) an Editor, else the plain IMAP reading. The letters come from BlueMind's Acl.java and were not yet observed on a delegate's MYRIGHTS.
      Specified by:
      presetOf in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      rights - the letters a server answered
      Returns:
      the preset
    • subscribe

      public void subscribe(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String ownerIdentifier)
      Accepts a share on BlueMind: subscribes the caller to the owner's mailbox, as BlueMind's own clients hold it, once the caller's session is checked to be the account of the caller's recorded address. An owner eXo knows by login only -- discovered while BlueMind could not name it by address -- cannot be subscribed to from eXo: the subscription of that name must be held already, and once the grantee has left it, it can be taken up again only in BlueMind's own interface.
      Specified by:
      subscribe in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the grantee's own session
      ownerIdentifier - the owner's address, or login
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - serverRefused when the session is not the recorded account, the owner cannot be resolved, or the owner is the caller
    • unsubscribe

      public void unsubscribe(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, String ownerIdentifier)
      Withdraws the caller's subscription to the owner's mailbox, once the caller's session is checked as subscribe(org.exoplatform.emailConnector.service.acl.MailboxAclSession, java.lang.String) checks it. An owner the directory no longer knows has nothing to withdraw.
      Specified by:
      unsubscribe in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Parameters:
      session - the grantee's own session
      ownerIdentifier - the owner's address
      Throws:
      org.exoplatform.emailConnector.exception.MailboxAclException - serverRefused when the session is not the recorded account, or the owner is the caller
    • serverNotifiesOwner

      public boolean serverNotifiesOwner()
      BlueMind e-mails the owner on every rights change.
      Specified by:
      serverNotifiesOwner in interface org.exoplatform.emailConnector.service.acl.MailboxAclEngine
      Returns:
      true