Docs For Class CalDAVRequest

## CalDAVRequest

Description

A class for collecting things to do with this request.

Located in /inc/CalDAVRequest.php (line 30)

Variable Summary
mixed $collection_id
mixed $collection_path
mixed $collection_type
mixed $current_user_principal_xml
mixed $depth
mixed $destination
mixed $exists
mixed $method
mixed $options
DAVPrincipal $principal
mixed $privileges
mixed $raw_post
mixed $supported_privileges
mixed $ticket
mixed $user_agent
Method Summary
static void kill_on_exit ()
CalDAVRequest __construct ([ $options = array()])
void AllowedTo (string $activity)
void BuildSupportedPrivileges ( &$reply, [ $privs = null])
void CheckEtagMatch (boolean $exists, string $dest_etag)
void CoerceContentType ()
void CollectionId ()
void dav_name ()
void DepthRegexTail ([ $for_collection_report = false])
void DoResponse (int $status, [string $message = ""], [ $content_type = "text/plain; charset=\"utf-8\""])
mixed FailIfLocked ()
void GetDepthName ()
void GetLockDetails (string $lock_token)
void GetLockRow ( $lock_token, string $dav_name)
void HavePrivilegeTo ( $do_what)
void IsAddressBook ()
void IsCalendar ()
void IsCollection ()
void IsInfiniteDepth ()
void IsLocked ()
void IsPrincipal ()
void IsProxyRequest ()
void IsPublic ()
void MalformedRequest ([string $text = 'Bad request'])
void NeedPrivilege ( $privileges, [string $href = null], string $privilege)
void PreconditionFailed (int $status, string $precondition, [string $explanation = ''], [ $xmlns = 'DAV:'])
void PreferMinimal ()
void Privileges ()
void setPermissions (int $user_no)
void UnsupportedRequest (array $unsupported)
void ValidateLockToken (string $lock_token)
void XMLResponse (int $status, XMLElement $xmltree)
Variables
mixed $collection_id (line 70)

The ID of the collection containing this path, or of this path if it is a collection

mixed $collection_path (line 75)

The path corresponding to the collection_id

mixed $collection_type (line 81)

The type of collection being requested:

calendar, schedule-inbox, schedule-outbox

mixed $current_user_principal_xml (line 60)

The 'current_user_principal_xml' the DAV:current-user-principal answer. An XMLElement object with an <href> or <unauthenticated> fragment.

mixed $depth (line 48)

The depth parameter from the request headers, coerced into a valid integer: 0, 1 or DEPTH_INFINITY which is defined above. The default is set per various RFCs.

mixed $destination (line 92)

The value of any 'Destionation:' header, if present.

mixed $exists (line 87)

The type of collection being requested:

calendar, schedule-inbox, schedule-outbox

- access: protected

mixed $method (line 42)

The HTTP request method: PROPFIND, LOCK, REPORT, OPTIONS, etc...

mixed $options (line 32)
DAVPrincipal $principal (line 54)

The 'principal' (user/resource/...) which this request seeks to access

mixed $privileges (line 97)

The decimal privileges allowed by this user to the identified resource.

- access: protected

mixed $raw_post (line 37)

The raw data sent along with the request

mixed $supported_privileges (line 102)

A static structure of supported privileges.

mixed $ticket (line 107)

A DAVTicket object, if there is a ?ticket=id or Ticket: id with this request

- access: public

mixed $user_agent (line 65)

The user agent making the request.

Methods
static kill_on_exit (line 1271)

- access: public

void kill_on_exit ()
Constructor __construct (line 118)

Create a new CalDAVRequest object.

CalDAVRequest __construct ([ $options = array()])

- $options

AllowedTo (line 1048)

Are we allowed to do the requested activity

+------------+------------------------------------------------------+ | METHOD | PRIVILEGES | +------------+------------------------------------------------------+ | MKCALENDAR | DAV:bind | | REPORT | DAV:read or CALDAV:read-free-busy (on all referenced | | | resources) | +------------+------------------------------------------------------+

void AllowedTo (string $activity)

- string $activity: The activity we want to do.

BuildSupportedPrivileges (line 1010)

Returns the array of supported privileges converted into XMLElements

void BuildSupportedPrivileges ( &$reply, [ $privs = null])

- &$reply
- $privs

CheckEtagMatch (line 1124)

Check that the incoming Etag matches the one for the existing (or non-existing) resource.

void CheckEtagMatch (boolean $exists, string $dest_etag)

- boolean $exists: Whether the destination exists
- string $dest_etag: The etag for the destination.

CoerceContentType (line 891)

Coerces the Content-type of the request into something valid/appropriate

void CoerceContentType ()
CollectionId (line 1002)

Returns the ID of the collection of, or containing this request

void CollectionId ()
dav_name (line 756)

Returns the dav_name of the resource in our internal namespace

void dav_name ()
DepthRegexTail (line 774)

Returns the tail of a Regex appropriate for this Depth, when appended to

void DepthRegexTail ([ $for_collection_report = false])

- $for_collection_report

DoResponse (line 1282)

Utility function we call when we have a simple status-based response to return to the client. Possibly

void DoResponse (int $status, [string $message = ""], [ $content_type = "text/plain; charset=\"utf-8\""])

- int $status: The HTTP status code to send.
- string $message: The friendly text message to send with the response.
- $content_type

FailIfLocked (line 856)

This will either (a) return false if no locks apply, or (b) return the lock_token which the request successfully included to open the lock, or: (c) respond directly to the client with the failure.

- return: false (no lock) or opaquelocktoken (opened lock)

mixed FailIfLocked ()
GetDepthName (line 765)

Returns the name for this depth: 0, 1, infinity

void GetDepthName ()
GetLockDetails (line 842)

Returns the DB object associated with a lock token, or false.

void GetLockDetails (string $lock_token)

- string $lock_token: The opaquelocktoken which we are looking for

GetLockRow (line 786)

Returns the locked row, either from the cache or from the database

void GetLockRow ( $lock_token, string $dav_name)

- string $dav_name: The resource which we want to know the lock status for
- $lock_token

HavePrivilegeTo (line 1174)

Is the user has the privileges to do what is requested.

void HavePrivilegeTo ( $do_what)

- $do_what

IsAddressBook (line 963)

Returns true if the URL referenced by this request points at an addressbook collection.

void IsAddressBook ()
IsCalendar (line 954)

Returns true if the URL referenced by this request points at a calendar collection.

void IsCalendar ()
IsCollection (line 943)

Returns true if the URL referenced by this request points at a collection.

void IsCollection ()
IsInfiniteDepth (line 994)

Returns true if the request asked for infinite depth

void IsInfiniteDepth ()
IsLocked (line 677)

Checks whether the resource is locked, returning any lock token, or false

- todo: This logic does not catch all locking scenarios. For example an infinite depth request should check the permissions for all collections and resources within that. At present we only maintain permissions on a per-collection basis though.

void IsLocked ()
IsPrincipal (line 972)

Returns true if the URL referenced by this request points at a principal.

void IsPrincipal ()
IsProxyRequest (line 983)

Returns true if the URL referenced by this request is within a proxy URL

void IsProxyRequest ()
IsPublic (line 714)

Checks whether the collection is public

void IsPublic ()
MalformedRequest (line 1251)

Send a simple error informing the client that was a malformed request

void MalformedRequest ([string $text = 'Bad request'])

- string $text: An optional text description of the failure.

NeedPrivilege (line 1210)

Send a need-privileges error response. This function will only return if the $href is not supplied and the current user has the specified permission for the request path.

void NeedPrivilege ( $privileges, [string $href = null], string $privilege)

- string $privilege: The name of the needed privilege.
- string $href: The unconstructed URI where we needed the privilege.
- $privileges

PreconditionFailed (line 1235)

Send an error response for a failed precondition.

void PreconditionFailed (int $status, string $precondition, [string $explanation = ''], [ $xmlns = 'DAV:'])

- int $status: The status code for the failed precondition. Normally 403
- string $precondition: The namespaced precondition tag.
- string $explanation: An optional text explanation for the failure.
- $xmlns

PreferMinimal (line 932)

Returns true if the 'Prefer: return-minimal' or 'Brief: t' were present in the request headers.

void PreferMinimal ()
Privileges (line 1113)

Return the privileges bits for the current session user to this resource

void Privileges ()
setPermissions (line 609)

Permissions are controlled as follows:

1. if the path is '/', the request has read privileges
2. if the requester is an admin, the request has read/write priviliges
3. if there is a <user name> component which matches the logged on user then the request has read/write privileges
4. otherwise we query the defined relationships between users and use the minimum privileges returned from that analysis.

void setPermissions (int $user_no)

- int $user_no: The current user number

UnsupportedRequest (line 1187)

Sometimes it's a perfectly formed request, but we just don't do that :-(

void UnsupportedRequest (array $unsupported)

- array $unsupported: An array of the properties we don't support.

ValidateLockToken (line 811)

Checks to see whether the lock token given matches one of the ones handed in with the request.

void ValidateLockToken (string $lock_token)

- string $lock_token: The opaquelocktoken which we are looking for

XMLResponse (line 1263)

Send an XML Response. This function will never return.

void XMLResponse (int $status, XMLElement $xmltree)

- int $status: The HTTP status to respond
- XMLElement $xmltree: An XMLElement tree to be rendered

Documentation generated on Sun, 08 Jul 2012 12:53:47 +0000 by phpDocumentor 1.4.3