Methods summary
public
|
#
__construct( mixed $options = array() )
Create a new CalDAVRequest object.
Create a new CalDAVRequest object.
|
public
|
#
setPermissions( )
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.
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.
|
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( mixed $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
string $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
string $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
string $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( mixed & $reply, mixed $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
+------------+------------------------------------------------------+
+------------+------------------------------------------------------+
MKCALENDAR |
DAV:bind |
REPORT |
DAV:read or CALDAV:read-free-busy (on all referenced |
|
resources) |
+------------+------------------------------------------------------+
Parameters
- $activity
string $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
boolean $exists Whether the destination exists
- $dest_etag
string $dest_etag The etag for the destination.
|
public
|
#
HavePrivilegeTo( mixed $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
array $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
string $privilege The name of the needed privilege.
- $href
string $href The unconstructed URI where we needed the privilege.
|
public
|
#
PreconditionFailed( integer $status, string $precondition, string $explanation = '', mixed $xmlns = 'DAV:' )
Send an error response for a failed precondition.
Send an error response for a failed precondition.
Parameters
- $status
integer $status The status code for the failed precondition. Normally 403
- $precondition
string $precondition The namespaced precondition tag.
- $explanation
string $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
string $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
integer $status The HTTP status to respond
- $xmltree
XMLElement $xmltree An XMLElement tree to be rendered
|
public static
|
|
public
|
#
DoResponse( integer $status, string $message = "", mixed $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
integer $status The HTTP status code to send.
- $message
string $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
status The HTTP status code for this response
- $response_size
response_size The size of the response (bytes).
- $script_time
script_time The time taken to generate the response (pre-sending)
- $flush_time
flush_time The time taken to send the response (buffers flushed)
|
Properties summary
public
mixed
|
$options
|
|
|
public
mixed
|
$raw_post
|
|
#
The raw data sent along with the request
The raw data sent along with the request
|
public
mixed
|
$method
|
|
#
The HTTP request method: PROPFIND, LOCK, REPORT, OPTIONS, etc...
The HTTP request method: PROPFIND, LOCK, REPORT, OPTIONS, etc...
|
public
mixed
|
$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
mixed
|
$current_user_principal_xml
|
|
#
The 'current_user_principal_xml' the DAV:current-user-principal answer. An
XMLElement object with an <href> or <unauthenticated> fragment.
The 'current_user_principal_xml' the DAV:current-user-principal answer. An
XMLElement object with an <href> or <unauthenticated> fragment.
|
public
mixed
|
$user_agent
|
|
#
The user agent making the request.
The user agent making the request.
|
public
mixed
|
$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
mixed
|
$collection_path
|
|
#
The path corresponding to the collection_id
The path corresponding to the collection_id
|
public
mixed
|
$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
mixed
|
$exists
|
|
#
The type of collection being requested:
calendar, schedule-inbox, schedule-outbox
The type of collection being requested: calendar, schedule-inbox,
schedule-outbox
|
public
mixed
|
$destination
|
|
#
The value of any 'Destionation:' header, if present.
The value of any 'Destionation:' header, if present.
|
protected
mixed
|
$privileges
|
|
#
The decimal privileges allowed by this user to the identified resource.
The decimal privileges allowed by this user to the identified resource.
|
public
mixed
|
$supported_privileges
|
|
#
A static structure of supported privileges.
A static structure of supported privileges.
|
public
mixed
|
$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
|