Package com.norconex.committer.core.acl
Record Class Acl
java.lang.Object
java.lang.Record
com.norconex.committer.core.acl.Acl
- Record Components:
version- the version of this shape, 1 for now; a committer rejects a version it does not knowstatus- how much of the permissions this holdsscope- which of the source's permissions were asked forunread- what could not be read, in a few words each, when the status isAclStatus.PARTIALorAclStatus.NONE(for example"share permissions: access denied")levels- the checks to pass, in order; empty when the status isAclStatus.NONEowners- who owns the document (entries without access), for the destinations that keep owners; not part of the access decisionnativeData- the source's own permission entries, untouched, for audit or custom use; may benull
public record Acl(int version, @NonNull AclStatus status, @NonNull AclScope scope, List<String> unread, List<AclLevel> levels, List<AclEntry> owners, Map<String,Object> nativeData)
extends Record
Who may read a document, in one shape whatever the source: a fetcher
that reads a source's permissions writes it on the document (see
AclCodec, and the "crawler.acl" field), and a committer
translates it for its destination, or sends it as is.
A person may read the document only if every one of its levels()
allows them. Most documents have one level; some sources check several,
such as a file share's permissions and then the file's own.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAcl(int version, @NonNull AclStatus status, @NonNull AclScope scope, List<String> unread, List<AclLevel> levels, List<AclEntry> owners, Map<String, Object> nativeData) Copies the levels, the owners and what was not read (none whennull: an empty list is not written), the owners without duplicates and in their canonical order, what was not read without duplicates and sorted. -
Method Summary
Modifier and TypeMethodDescriptionstatic AclA complete ACL of everything the source has.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.levels()Returns the value of thelevelsrecord component.Returns the value of thenativeDatarecord component.static AclAn ACL for a document whose permissions were asked for and could not be read at all.owners()Returns the value of theownersrecord component.@NonNull AclScopescope()Returns the value of thescoperecord component.@NonNull AclStatusstatus()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.unread()Returns the value of theunreadrecord component.intversion()Returns the value of theversionrecord component.withStatus(AclStatus status) withUnread(List<String> what) A copy of this ACL markedAclStatus.PARTIAL, saying what could not be read.
-
Field Details
-
FIELD
The document field holding a document's ACL as JSON.- See Also:
-
VERSION
public static final int VERSIONThe version of this shape that this code writes and reads.- See Also:
-
-
Constructor Details
-
Acl
public Acl(int version, @NonNull @NonNull AclStatus status, @NonNull @NonNull AclScope scope, List<String> unread, List<AclLevel> levels, List<AclEntry> owners, Map<String, Object> nativeData) Copies the levels, the owners and what was not read (none whennull: an empty list is not written), the owners without duplicates and in their canonical order, what was not read without duplicates and sorted.- Parameters:
version- the version of this shapestatus- how much of the permissions this holdsscope- which permissions were asked forunread- what could not be readlevels- the checks to pass, in orderowners- who owns the documentnativeData- the source's own entries
-
-
Method Details
-
complete
public static Acl complete(List<AclLevel> levels, List<AclEntry> owners, Map<String, Object> nativeData) A complete ACL of everything the source has.- Parameters:
levels- the checks to pass, in orderowners- who owns the documentnativeData- the source's own entries, ornull- Returns:
- the ACL
-
none
An ACL for a document whose permissions were asked for and could not be read at all.- Parameters:
scope- which permissions were asked forwhy- why they could not be read, in a few words- Returns:
- the ACL
-
withStatus
- Parameters:
status- the status to give- Returns:
- a copy of this ACL with another status
-
withUnread
A copy of this ACL markedAclStatus.PARTIAL, saying what could not be read. Does nothing whenwhatis empty.- Parameters:
what- what could not be read, in a few words each- Returns:
- the partial ACL, or this one when nothing is given
-
withScope
- Parameters:
scope- the scope to give- Returns:
- a copy of this ACL with another scope
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
version
public int version()Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
scope
Returns the value of thescoperecord component.- Returns:
- the value of the
scoperecord component
-
unread
Returns the value of theunreadrecord component.- Returns:
- the value of the
unreadrecord component
-
levels
Returns the value of thelevelsrecord component.- Returns:
- the value of the
levelsrecord component
-
owners
Returns the value of theownersrecord component.- Returns:
- the value of the
ownersrecord component
-
nativeData
Returns the value of thenativeDatarecord component.- Returns:
- the value of the
nativeDatarecord component
-