Interface PublicDocumentAccessService


public interface PublicDocumentAccessService
  • Method Details

    • createPublicDocumentAccess

      @Deprecated(forRemoval=true, since="7.3.0") PublicDocumentAccess createPublicDocumentAccess(long docOwnerId, String nodeId, String password, Long expirationDate, boolean hasPassword)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use createDocumentPublicAccess(long, String, String, Long, boolean), which applies the document's space settings to the user creating the link; a refusal is thrown here as an IllegalStateException
      Creates a public access for a document
      Parameters:
      docOwnerId - document owner
      nodeId - document node id
      password - password of the public access
      expirationDate - public access expiration date
      hasPassword - document has already old password
      Returns:
      PublicDocumentAccess
    • createDocumentPublicAccess

      PublicDocumentAccess createDocumentPublicAccess(long userIdentityId, String documentId, String password, Long expirationDate, boolean hasPassword) throws IllegalAccessException
      Creates or updates a document public access on behalf of a user.
      Parameters:
      userIdentityId - social identity id of the user creating the link
      documentId - document node id
      password - password of the public access
      expirationDate - public access expiration date
      hasPassword - document has already old password
      Returns:
      PublicDocumentAccess, null when it could not be saved
      Throws:
      DocumentSharingRefusedException - when the document's space refuses the user to manage its access
      IllegalAccessException - when the user is unknown
    • getPublicDocumentAccess

      PublicDocumentAccess getPublicDocumentAccess(String documentId)
      Gets a document public access by its node id
      Parameters:
      documentId - node id
      Returns:
      PublicDocumentAccess
    • isPublicDocumentAccessExpired

      boolean isPublicDocumentAccessExpired(String documentId)
      Checks if public access expired. A document whose space keeps its documents inside is answered as a document with no link: expired.
      Parameters:
      documentId - node id
      Returns:
      true or false
    • isDocumentPublicAccessValid

      boolean isDocumentPublicAccessValid(String documentId, String password)
      Checks the validity of a public access. A document whose space keeps its documents inside is answered as a document with no link: not valid.
      Parameters:
      documentId - node id
      password - password of the document public access
      Returns:
      true if access is valid or false else
    • isProtectedBySpace

      boolean isProtectedBySpace(String documentId)
      Whether the document's space keeps its documents inside, on the space's committed settings: its public link, if it has one, then serves nothing. A document whose space or settings cannot be read is protected.
      Parameters:
      documentId - document id
      Returns:
      true when the document's public link must serve nothing
    • getLinkAccess

      PublicLinkAccess getLinkAccess(String documentId, String password)
      Decides what the document's public link grants an anonymous visitor, on one read of the link and, when it has one, of its space's committed settings: a document whose space keeps its documents inside is answered as a document with no link, before its expiry or its password is read.
      Parameters:
      documentId - document id
      password - the password the visitor gave, null when none
      Returns:
      the link's answer
    • hasDocumentPublicAccess

      boolean hasDocumentPublicAccess(String documentId)
      Checks if a document has public access
      Parameters:
      documentId - document id
      Returns:
      true or false
    • getPublicDocumentInfo

      PublicDocumentInfo getPublicDocumentInfo(String documentId) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Gets what the public link page shows of a document that has a public access link: whether the link asks for a password or has expired, and the document's name and mime type, without reading its content. The link is read once and its password is never decoded. Nothing of the document is read when it has no public access link. A document whose space keeps its documents inside is answered as a document with no link.
      Parameters:
      documentId - document id
      Returns:
      PublicDocumentInfo
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the document has no public access link, no longer exists or cannot be read
    • revokeDocumentPublicAccess

      @Deprecated(forRemoval=true, since="7.3.0") void revokeDocumentPublicAccess(String documentId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use revokeDocumentPublicAccess(String, long), which applies the document's space settings to the user revoking
      Revokes a document public access, with no check of the caller.
      Parameters:
      documentId - document id
    • revokeDocumentPublicAccess

      void revokeDocumentPublicAccess(String documentId, long userIdentityId) throws IllegalAccessException
      Revokes a document public access on behalf of a user.
      Parameters:
      documentId - document id
      userIdentityId - social identity id of the user revoking the link
      Throws:
      DocumentSharingRefusedException - when the document's space refuses the user to manage its access
      IllegalAccessException - when the user is unknown