Kantoor. Dav. Local
(Kantoor v1.0.0)
In-app writer for the DAV store: the tasks, calendar and contacts pages store
documents through here, which runs them through exactly the validators and
scheduling hooks of a client's PUT / DELETE (so a task made in the browser
is a normal VTODO resource a phone syncs, and an event with attendees sends its
invitations). Always acts as one user: another user's collections do not exist
for it.
Summary
Functions
The user's collections of a home, in display order.
Deletes a resource the way DELETE does (attendees are told). Idempotent.
Makes sure the user's default collections exist.
Like get_object/3, as an {:ok, {object, collection}} / {:error, :not_found} tuple.
Like fetch_object/3 but also finds members of collections shared with the
user, and returns the collection as a View (with the permission the user
holds right now). Another user's object with no grant is {:error, :not_found}.
The user's object with id and its collection slug, or nil.
Alias for the store's href of a collection.
A SQL LIKE pattern matching text literally anywhere.
An object resource name for a UID.
True when the document carries an ORGANIZER: it is a scheduling object, which
belongs to its organiser and the people invited. In a collection shared with
the user it is not theirs to change or delete (the DAV library refuses the
same), and since nothing may be scheduled from a shared collection, the in-app
writers refuse it up front.
Stores body as name in the user's collection slug (in home).
The user's collections of a home as Kantoor.Dav.Views: their own in display
order, then the ones shared with them (by owner), each with the permission
they hold now. Read from the database on every call.
Functions
@spec collections(Ecto.UUID.t(), String.t()) :: [Kantoor.Dav.Collection.t()]
The user's collections of a home, in display order.
@spec delete(Ecto.UUID.t(), String.t(), String.t(), String.t()) :: :ok | {:error, term()}
Deletes a resource the way DELETE does (attendees are told). Idempotent.
@spec ensure(Ecto.UUID.t()) :: :ok
Makes sure the user's default collections exist.
@spec fetch_object(Ecto.UUID.t(), term(), String.t()) :: {:ok, {Kantoor.Dav.Object.t(), Kantoor.Dav.Collection.t()}} | {:error, :not_found}
Like get_object/3, as an {:ok, {object, collection}} / {:error, :not_found} tuple.
@spec fetch_view_object(Ecto.UUID.t(), term(), String.t()) :: {:ok, {Kantoor.Dav.Object.t(), Kantoor.Dav.View.t()}} | {:error, :not_found}
Like fetch_object/3 but also finds members of collections shared with the
user, and returns the collection as a View (with the permission the user
holds right now). Another user's object with no grant is {:error, :not_found}.
@spec get_object(Ecto.UUID.t(), term(), String.t()) :: {Kantoor.Dav.Object.t(), Kantoor.Dav.Collection.t()} | nil
The user's object with id and its collection slug, or nil.
Alias for the store's href of a collection.
A SQL LIKE pattern matching text literally anywhere.
An object resource name for a UID.
True when the document carries an ORGANIZER: it is a scheduling object, which
belongs to its organiser and the people invited. In a collection shared with
the user it is not theirs to change or delete (the DAV library refuses the
same), and since nothing may be scheduled from a shared collection, the in-app
writers refuse it up front.
@spec put( Ecto.UUID.t(), String.t(), String.t(), String.t(), binary(), String.t(), keyword() ) :: {:ok, :created | :replaced, String.t()} | {:error, term()}
Stores body as name in the user's collection slug (in home).
{:ok, :created | :replaced, etag} or {:error, reason}; reason is a
library precondition ({namespace, name}), :conflict or :forbidden.
slug is the path segment in the user's own home: a real slug, or
shared-<id> for a collection shared with them. A shared one needs a write
grant (checked by Kantoor.Dav.ShareGuard, the check the DAV path runs, and
again by the store), and nothing written into it runs the scheduling hooks, so
no invitation is ever sent from here on the owner's behalf. Option
:scheduling (default true) set to false stores without the hooks for any
collection: storing a copy of an invitation is not an answer to it.
@spec views(Ecto.UUID.t(), String.t()) :: [Kantoor.Dav.View.t()]
The user's collections of a home as Kantoor.Dav.Views: their own in display
order, then the ones shared with them (by owner), each with the permission
they hold now. Read from the database on every call.