Class SpaceAccessClassifier

java.lang.Object
org.exoplatform.documents.util.SpaceAccessClassifier

public class SpaceAccessClassifier extends Object
Decides whether an entry of a space document's stored access list reaches outside the space. An entry is inside when it is a membership of the space's own group (*, manager, member, redactor, publisher), the document's owner, a member of the space, or an identity present on the access list of the space's drive root; every other entry, everyone (any) included, is outside. The caller decides where membership is read from: the cached space for a listing, the committed rows for a refusal or a removal.
  • Field Details

    • SPACE_MEMBERSHIP_TYPES

      public static final Set<String> SPACE_MEMBERSHIP_TYPES
      The membership types of the space's own group an entry may hold inside
  • Constructor Details

    • SpaceAccessClassifier

      public SpaceAccessClassifier(String spaceGroupId, Predicate<String> isMember, Set<String> driveRootIdentities)
      Parameters:
      spaceGroupId - the space's group, such as /spaces/team
      isMember - tells whether a user is a member of the space
      driveRootIdentities - the identities of the access list of the space's drive root
  • Method Details

    • hasOutsideEntry

      public boolean hasOutsideEntry(Collection<String> identities, String owner)
      Parameters:
      identities - the identities of a document's access list, one per entry, repeated when an identity holds several permissions
      owner - the document's owner, null when it has none
      Returns:
      true when at least one entry reaches outside the space
    • isOutside

      public boolean isOutside(String identity, String owner)
      Parameters:
      identity - the identity of an access entry: a user name, a membership such as manager:/spaces/team, or any
      owner - the document's owner, null when it has none
      Returns:
      true when the entry reaches outside the space