Overview

Packages

  • awl
    • caldav-client-v2
    • RRule
  • davical
    • authentication
      • drivers
    • caldav
    • DAViCalSession
    • DAVTicket
    • external-bind
    • feed
    • HTTPAuthSession
    • iSchedule
    • iSchedule-POST
    • logging
    • metrics
    • Principal
    • propfind
    • PublicSession
    • Request
    • Resource
    • tzservice
  • None

Classes

  • CalDAVRequest
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class CalDAVRequest

A class for collecting things to do with this request.

Package: davical\Request
Copyright: Catalyst .Net Ltd, Morphoss Ltd
License: GNU GPL v3 or later
Author: Andrew McMillan andrew@mcmillan.net.nz
Located at CalDAVRequest.php
Methods summary
public
# __construct( $options = array() )

Create a new CalDAVRequest object.

Create a new CalDAVRequest object.

public
# setPermissions( integer $user_no,… )

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 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.

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 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.

Parameters

$user_no,…
The current user number
public
# IsLocked( )

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

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.


public
# IsPublic( )

Checks whether the collection is public

Checks whether the collection is public

public
# dav_name( )

Returns the dav_name of the resource in our internal namespace

Returns the dav_name of the resource in our internal namespace

public
# GetDepthName( )

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

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

public
# DepthRegexTail( $for_collection_report = false )

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

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

public
# GetLockRow( string $lock_token )

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

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

Parameters

$lock_token
$dav_name The resource which we want to know the lock status for
public
# ValidateLockToken( string $lock_token )

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

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

Parameters

$lock_token
The opaquelocktoken which we are looking for
public
# GetLockDetails( string $lock_token )

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

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

Parameters

$lock_token
The opaquelocktoken which we are looking for
public mixed
# FailIfLocked( )

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.

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.

Returns

mixed
false (no lock) or opaquelocktoken (opened lock)
public
# CoerceContentType( )

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

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

public
# PreferMinimal( )

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

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

public
# IsCollection( )

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

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

public
# IsCalendar( )

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

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

public
# IsAddressBook( )

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

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

public
# IsPrincipal( )

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

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

public
# IsProxyRequest( )

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

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

public
# IsInfiniteDepth( )

Returns true if the request asked for infinite depth

Returns true if the request asked for infinite depth

public
# CollectionId( )

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

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

public
# BuildSupportedPrivileges( & $reply, $privs = null )

Returns the array of supported privileges converted into XMLElements

Returns the array of supported privileges converted into XMLElements

public
# AllowedTo( string $activity )

Are we allowed to do the requested activity

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) | +------------+------------------------------------------------------+

Parameters

$activity
The activity we want to do.
public
# Privileges( )

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

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

public
# CheckEtagMatch( boolean $exists, string $dest_etag )

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

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

Parameters

$exists
Whether the destination exists
$dest_etag
The etag for the destination.
public
# HavePrivilegeTo( $do_what )

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

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

public
# UnsupportedRequest( array $unsupported )

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

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

Parameters

$unsupported
An array of the properties we don't support.
public
# NeedPrivilege( string $privileges, string $href = null )

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.

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.

Parameters

$privileges
$privilege The name of the needed privilege.
$href
The unconstructed URI where we needed the privilege.
public
# PreconditionFailed( integer $status, string $precondition, string $explanation = '', $xmlns = 'DAV:' )

Send an error response for a failed precondition.

Send an error response for a failed precondition.

Parameters

$status
The status code for the failed precondition. Normally 403
$precondition
The namespaced precondition tag.
$explanation
An optional text explanation for the failure.
$xmlns
public
# MalformedRequest( string $text = 'Bad request' )

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

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

Parameters

$text
An optional text description of the failure.
public
# XMLResponse( integer $status, XMLElement $xmltree )

Send an XML Response. This function will never return.

Send an XML Response. This function will never return.

Parameters

$status
The HTTP status to respond
$xmltree
An XMLElement tree to be rendered
public static
# kill_on_exit( )
public
# DoResponse( integer $status, string $message = "", $content_type = "text/plain; charset=\"utf-8\"" )

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

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

Parameters

$status
The HTTP status code to send.
$message
The friendly text message to send with the response.
$content_type
public
# DoMetrics( status $status, response_size $response_size, script_time $script_time, flush_time $flush_time )

Record the metrics related to this request.

Record the metrics related to this request.

Parameters

$status
HTTP status code for this response
$response_size
size of the response (bytes).
$script_time
time taken to generate the response (pre-sending)
$flush_time
time taken to send the response (buffers flushed)
Properties summary
public $options
#
public $raw_post

The raw data sent along with the request

The raw data sent along with the request

#
public $method

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

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

#
public $depth

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.

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.

#
public DAVPrincipal $principal

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

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

#
public $current_user_principal_xml

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

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

#
public $user_agent

The user agent making the request.

The user agent making the request.

#
public $collection_id

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

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

#
public $collection_path

The path corresponding to the collection_id

The path corresponding to the collection_id

#
public $collection_type

The type of collection being requested: calendar, schedule-inbox, schedule-outbox

The type of collection being requested: calendar, schedule-inbox, schedule-outbox

#
protected $exists

The type of collection being requested: calendar, schedule-inbox, schedule-outbox

The type of collection being requested: calendar, schedule-inbox, schedule-outbox

#
public $destination

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

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

#
protected $privileges

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

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

#
public $supported_privileges

A static structure of supported privileges.

A static structure of supported privileges.

#
public $ticket

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

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

#
DAViCal API documentation generated by ApiGen