Package org.exoplatform.caldav.client
Record Class AccessControlEntry
java.lang.Object
java.lang.Record
org.exoplatform.caldav.client.AccessControlEntry
- Record Components:
principal- whom the entry applies toinverted- whether it applies to everyone except that principal (DAV:invert)deny- whether it denies rather than grantsprivileges- the privileges granted or denied, as Clark names, never empty for a parsed entryprotectedEntry- whether the server marks itDAV:protected: it cannot be changed, and it is never sent backinheritedFrom- the resource it is inherited from (DAV:inherited), null when it is this collection's own; an inherited entry is never sent back either
public record AccessControlEntry(AccessControlEntry.AcePrincipal principal, boolean inverted, boolean deny, Set<String> privileges, boolean protectedEntry, String inheritedFrom)
extends Record
One access control entry of a collection's
DAV:acl, as RFC 3744
§5.5 defines it: who it applies to, whether it grants or denies, which
privileges, and whether the server lets it be changed (EXO-90253).
The client parses every entry into this shape entirely or not at
all (CollectionAcl.understood()): an ACL request replaces
every entry that is neither protected nor inherited (§8.1), so an entry this
record could not represent would be deleted by writing the list back. The
shape is therefore the whole grammar of §5.5 and no less.
Privileges are held as Clark names, {namespace}local —
{DAV:}read, {urn:ietf:params:xml:ns:caldav}read-free-busy —
so a privilege of any namespace survives the round trip.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhom an entry applies to: one of the six forms RFC 3744 §5.5.1 allows. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe namespace of CalDAV's elements.static final StringThe namespace of WebDAV's own elements.static final StringDAV:read, the one privilege eXo grants.The privileges that let a principal see a calendar and nothing more: what "can view" means when an entry is read back. -
Constructor Summary
ConstructorsConstructorDescriptionAccessControlEntry(AccessControlEntry.AcePrincipal principal, boolean inverted, boolean deny, Set<String> privileges, boolean protectedEntry, String inheritedFrom) Creates an instance of aAccessControlEntryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether this entry names exactly one principal path, compared in the canonical form a recorded principal is held in.static StringA Clark name:{namespace}local.booleandeny()Returns the value of thedenyrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanWhether this entry lets a principal read the calendar: a grant, not inverted, namingDAV:readorDAV:all.booleanWhether this entry is a plain grant carrying nothing beyond seeing the calendar.final inthashCode()Returns a hash code value for this object.Returns the value of theinheritedFromrecord component.booleaninverted()Returns the value of theinvertedrecord component.booleanWhether anACLrequest may carry this entry: neither protected nor inherited (RFC 3744 §8.1 leaves both where they are, and sending one is a conflict the server refuses).Returns the value of theprincipalrecord component.static StringprincipalHrefOf(String canonicalPrincipal) The href a principal path is written as: every segment percent-encoded outside the unreserved set, and a trailing slash, since a principal is a collection.Returns the value of theprivilegesrecord component.booleanReturns the value of theprotectedEntryrecord component.static AccessControlEntryreadGrantTo(String principalHref) The entry eXo writes to share a calendar: grantDAV:readto one principal, nothing else.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DAV_NS
The namespace of WebDAV's own elements.- See Also:
-
CALDAV_NS
The namespace of CalDAV's elements.- See Also:
-
READ
DAV:read, the one privilege eXo grants. -
READ_ONLY_PRIVILEGES
The privileges that let a principal see a calendar and nothing more: what "can view" means when an entry is read back.DAV:readitself;read-current-user-privilege-set, which Stalwart reports beside it on a read share; andCALDAV:read-free-busy, which RFC 4791 §6.1.1 aggregates underDAV:read.
-
-
Constructor Details
-
AccessControlEntry
public AccessControlEntry(AccessControlEntry.AcePrincipal principal, boolean inverted, boolean deny, Set<String> privileges, boolean protectedEntry, String inheritedFrom) Creates an instance of aAccessControlEntryrecord class.- Parameters:
principal- the value for theprincipalrecord componentinverted- the value for theinvertedrecord componentdeny- the value for thedenyrecord componentprivileges- the value for theprivilegesrecord componentprotectedEntry- the value for theprotectedEntryrecord componentinheritedFrom- the value for theinheritedFromrecord component
-
-
Method Details
-
readGrantTo
The entry eXo writes to share a calendar: grantDAV:readto one principal, nothing else.- Parameters:
principalHref- the principal's server-absolute href- Returns:
- the entry
-
isModifiable
public boolean isModifiable()Whether anACLrequest may carry this entry: neither protected nor inherited (RFC 3744 §8.1 leaves both where they are, and sending one is a conflict the server refuses).- Returns:
- true for an entry of this collection's own that may be rewritten
-
grantsRead
public boolean grantsRead()Whether this entry lets a principal read the calendar: a grant, not inverted, namingDAV:readorDAV:all.- Returns:
- true when it grants read
-
grantsReadOnly
public boolean grantsReadOnly()Whether this entry is a plain grant carrying nothing beyond seeing the calendar.- Returns:
- true when every privilege is a read-only one
-
appliesTo
Whether this entry names exactly one principal path, compared in the canonical form a recorded principal is held in.- Parameters:
canonicalPrincipal- a principal path, canonical, not null- Returns:
- true when the entry's principal is an href naming it
-
principalHrefOf
The href a principal path is written as: every segment percent-encoded outside the unreserved set, and a trailing slash, since a principal is a collection. A canonical path decodes%40to@; this puts it back, so the server reads the spelling it answers itself.- Parameters:
canonicalPrincipal- a server-absolute principal path, decoded, with or without a trailing slash- Returns:
- the href
-
clark
A Clark name:{namespace}local.- Parameters:
namespace- the element's namespacelocalName- the element's local name- Returns:
- the Clark name
-
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 '=='. -
principal
Returns the value of theprincipalrecord component.- Returns:
- the value of the
principalrecord component
-
inverted
public boolean inverted()Returns the value of theinvertedrecord component.- Returns:
- the value of the
invertedrecord component
-
deny
public boolean deny()Returns the value of thedenyrecord component.- Returns:
- the value of the
denyrecord component
-
privileges
Returns the value of theprivilegesrecord component.- Returns:
- the value of the
privilegesrecord component
-
protectedEntry
public boolean protectedEntry()Returns the value of theprotectedEntryrecord component.- Returns:
- the value of the
protectedEntryrecord component
-
inheritedFrom
Returns the value of theinheritedFromrecord component.- Returns:
- the value of the
inheritedFromrecord component
-