Record Class 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
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.The privileges an edit share may hold when it is read back (EXO-90378): the read-only set,DAV:write, and the membersDAV:writeaggregates (RFC 3744 §3.12) — write-properties, write-content, bind and unbind.static final StringDAV:read, the privilege a "can view" share grants.The privileges that let a principal see a calendar and nothing more: what "can view" means when an entry is read back.static final StringDAV:write, the privilege a "can edit" share adds (EXO-90378). -
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.static AccessControlEntryeditGrantTo(String principalHref) The entry eXo writes to share a calendar for editing (EXO-90378): grantDAV:readandDAV:writeto one principal, nothing else.final booleanIndicates whether some other object is "equal to" this one.booleanWhether this entry is a plain grant carrying exactly what an eXo edit share grants (EXO-90378): reading and writing the calendar, and nothing beyondEDIT_PRIVILEGES.booleanWhether this entry is of a shape eXo itself writes — a read-only grant or an edit grant (EXO-90378) — and may therefore be carried back unchanged in anACLrequest without widening anybody's rights.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 privilege a "can view" share grants. -
WRITE
DAV:write, the privilege a "can edit" share adds (EXO-90378). RFC 3744 §3.12 aggregateswrite-properties,write-content,bindandunbindunder it — changing an event, adding one and removing one, which is what an edit share is for. A server may map it to more: on Stalwart it also lets the principal delete or rename the collection itself, seeEDIT_PRIVILEGES. -
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. -
EDIT_PRIVILEGES
The privileges an edit share may hold when it is read back (EXO-90378): the read-only set,DAV:write, and the membersDAV:writeaggregates (RFC 3744 §3.12) — write-properties, write-content, bind and unbind.The grant eXo writes is narrower than this:
DAV:readandDAV:writeand nothing else, seeeditGrantTo(String). A server is free to report the aggregate's members beside it, exactly as it reports the read-ish privileges besideDAV:read, and Stalwart does: it stores ourDAV:writeas its ownModify, Delete, AddItems, ModifyItems, RemoveItemsand reports those back asDAV:writeplusDAV:write-properties(fromModify) andDAV:write-content(fromModifyItems) —crates/dav/src/common/acl.rs,validate_and_map_acesandcurrent_user_privilege_set, stalwartlabs/stalwart v0.16.0.Leaving those two out is what made a grant that had landed read back as unrecognised, and eXo report a share it had really made as not applied. Nothing here widens eXo's own grant: every member is part of
DAV:writeitself. WhatDAV:writecarries is the server's to say, though, and on Stalwart it is more than writing the calendar's events: theDeleteandModifyit maps to also let the principal delete the collection itself, or change its name and properties (crates/dav/src/calendar/delete.rsandproppatch.rs, v0.16.0). That is accepted for a Can-edit share, because no Stalwart ACL grants deleting events without it.DAV:write-acl,DAV:read-acl,DAV:all,DAV:unlock, scheduling and vendor privileges stay outside it.
-
-
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
-
editGrantTo
The entry eXo writes to share a calendar for editing (EXO-90378): grantDAV:readandDAV:writeto one principal, nothing else.DAV:readis written even though a colleague who may write must be able to read: it is what makes the entry recognisable. A grant carryingDAV:writeand no read is what Stalwart reports for a right given through JMAP — "may delete", "may write all" — and eXo never writes that shape, so it can keep refusing to carry one back (grantsEditOnly()demands both).- 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
-
grantsEditOnly
public boolean grantsEditOnly()Whether this entry is a plain grant carrying exactly what an eXo edit share grants (EXO-90378): reading and writing the calendar, and nothing beyondEDIT_PRIVILEGES.Both
DAV:readandDAV:writeare required. That is what separates a grant eXo itself wrote from the one shape it must keep refusing: a bareDAV:write, which is how Stalwart reports a right given through JMAP, is not edit-only here, so writing the list back still stops rather than widening that right to full write. The aggregate itself is required, not merely its members, so a partial grant — content but not bind, say — is not mistaken for the whole.- Returns:
- true when every privilege is an edit-share one and both read and write are among them
-
grantsExoShape
public boolean grantsExoShape()Whether this entry is of a shape eXo itself writes — a read-only grant or an edit grant (EXO-90378) — and may therefore be carried back unchanged in anACLrequest without widening anybody's rights.- Returns:
- true for a grant eXo could have written
-
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
-