DAViCal
Loading...
Searching...
No Matches
DAVResource Class Reference
Inheritance diagram for DAVResource:

Public Member Functions

 __construct ( $parameters=null, DAVResource $prefetched_collection=null)
 
 FromRow ($row)
 
 FromPath ($inpath)
 
 GetParentContainer ()
 
 FetchParentContainer ()
 
 Privileges ()
 
 HavePrivilegeTo ( $do_what, $any=null)
 
 NeedPrivilege ( $privilege, $any=null)
 
 BuildPrivileges ( $privilege_names=null, &$xmldoc=null)
 
 FetchSupportedMethods ()
 
 BuildSupportedMethods ()
 
 FetchSupportedReports ()
 
 BuildSupportedReports (&$reply)
 
 FetchTickets ()
 
 BuildTicketinfo (&$reply)
 
 IsLocked ( $depth=0)
 
 IsCollection ()
 
 IsPrincipal ()
 
 IsCalendar ()
 
 IsProxyCollection ( $type='any')
 
 IsSchedulingCollection ( $type='any')
 
 IsInSchedulingCollection ( $type='any')
 
 IsAddressbook ()
 
 IsBinding ()
 
 IsExternal ()
 
 Exists ()
 
 ContainerExists ()
 
 url ()
 
 dav_name ()
 
 bound_from ()
 
 set_bind_location ( $new_dav_name)
 
 parent_path ()
 
 principal_url ()
 
 user_no ()
 
 collection_id ()
 
 timezone_name ()
 
 resource ()
 
 unique_tag ()
 
 resource_id ()
 
 sync_token ( $cachedOK=true)
 
 IsPublic ()
 
 IsPublicOnly ()
 
 ContainerType ()
 
 BuildACE (&$xmldoc, $privs, $principal)
 
 GetACL (&$xmldoc)
 
 GetProperty ( $name)
 
 DAV_AllProperties ()
 
 ResourceProperty ( $tag, $prop, &$reply, &$denied)
 
 GetPropStat ( $properties, &$reply, $props_only=false)
 
 RenderAsXML ( $properties, &$reply, $bound_parent_path=null)
 

Static Public Member Functions

static BuildDeadPropertyXML ($property_name, $raw_string)
 

Protected Member Functions

 FetchCollection ()
 
 FetchPrincipal ()
 
 FetchResource ()
 
 FetchDeadProperties ()
 
 FetchPrivileges ()
 

Protected Attributes

 $dav_name
 
 $exists
 
 $unique_tag
 
 $resource
 
 $parent
 
 $resourcetypes
 
 $contenttype
 
 $bound_from
 

Private Member Functions

 ReadCollectionFromDatabase ()
 

Private Attributes

 $collection
 
 $principal
 
 $privileges
 
 $_is_collection
 
 $_is_principal
 
 $_is_calendar
 
 $_is_binding
 
 $_is_external
 
 $_is_addressbook
 
 $_is_proxy_resource
 
 $proxy_type
 
 $supported_methods
 
 $supported_reports
 
 $dead_properties
 
 $supported_components
 
 $tickets
 
 $collection_type
 
 $created
 
 $displayname
 
 $modified
 
 $path_privs
 
 $principal_id
 
 $resource_id
 
 $user_no
 
 $access_tickets
 
 $parent_container_type
 
 $sync_token
 
 $_collection_is_cacheable
 

Detailed Description

Definition at line 24 of file DAVResource.php.

Constructor & Destructor Documentation

◆ __construct()

DAVResource::__construct (   $parameters = null,
DAVResource  $prefetched_collection = null 
)

Constructor

Parameters
mixed$parametersIf null, an empty Resourced is created. If it is an object then it is expected to be a record that was read elsewhere.
object$prefetched_collectionIf provided, the internal collection field of the resource is populated with the given data, so it does not need to be queried again later

Definition at line 176 of file DAVResource.php.

Member Function Documentation

◆ bound_from()

DAVResource::bound_from ( )

Returns the dav_name of the resource we are bound to, within our internal namespace

Returns
string

Definition at line 1287 of file DAVResource.php.

◆ BuildACE()

DAVResource::BuildACE ( $xmldoc,
  $privs,
  $principal 
)

BuildACE - construct an XMLElement subtree for a DAV::ace

Definition at line 1471 of file DAVResource.php.

◆ BuildDeadPropertyXML()

static DAVResource::BuildDeadPropertyXML (   $property_name,
  $raw_string 
)
static

FIXME: does this function return a string or an array, or either? It used to be string only, but b4fd9e2e changed successfully parsed values to array. However values not in angle brackets are passed through, and those seem to be the majority in my database?!

Definition at line 713 of file DAVResource.php.

◆ BuildPrivileges()

DAVResource::BuildPrivileges (   $privilege_names = null,
$xmldoc = null 
)

Returns the array of privilege names converted into XMLElements

Definition at line 883 of file DAVResource.php.

◆ BuildSupportedMethods()

DAVResource::BuildSupportedMethods ( )

Returns the array of supported methods converted into XMLElements

Definition at line 972 of file DAVResource.php.

◆ BuildSupportedReports()

DAVResource::BuildSupportedReports ( $reply)

Returns the array of supported reports converted into XMLElements

Definition at line 1025 of file DAVResource.php.

◆ BuildTicketinfo()

DAVResource::BuildTicketinfo ( $reply)

Returns the array of tickets converted into XMLElements

If the current user does not have DAV::read-acl privilege on this resource they will only get to see the tickets where they are the owner, or which they supplied along with the request.

Parameters
&XMLDocument$reply A reference to the XMLDocument used to construct the reply
Returns
XMLTreeFragment A fragment of an XMLDocument to go in the reply

Definition at line 1086 of file DAVResource.php.

◆ collection_id()

DAVResource::collection_id ( )

Returns the internal collection_id for this collection, or the collection containing this resource

Definition at line 1342 of file DAVResource.php.

◆ ContainerExists()

DAVResource::ContainerExists ( )

Checks whether the container for this resource actually exists, in the virtual sense, within the hierarchy

Definition at line 1252 of file DAVResource.php.

◆ ContainerType()

DAVResource::ContainerType ( )

Return the type of whatever contains this resource, or would if it existed.

Definition at line 1437 of file DAVResource.php.

◆ DAV_AllProperties()

DAVResource::DAV_AllProperties ( )

Return an array which is an expansion of the DAV::allprop

Definition at line 1602 of file DAVResource.php.

◆ dav_name()

DAVResource::dav_name ( )

Returns the dav_name of the resource in our internal namespace

Returns
string

Definition at line 1277 of file DAVResource.php.

◆ Exists()

DAVResource::Exists ( )

Checks whether this resource actually exists, in the virtual sense, within the hierarchy

Definition at line 1234 of file DAVResource.php.

◆ FetchCollection()

DAVResource::FetchCollection ( )
protected

Find the collection associated with this resource.

RFC4918, 8.3: Identifiers for collections SHOULD end in '/'

  • also discussed at more length in 5.2

So we look for a collection which matches one of the following URLs:

  • The exact request.
  • If the exact request, doesn't end in '/', then the request URL with a '/' appended
  • The request URL truncated to the last '/' The collection URL for this request is therefore the longest row in the result, so we can "... ORDER BY LENGTH(dav_name) DESC LIMIT 1"

Definition at line 551 of file DAVResource.php.

◆ FetchDeadProperties()

DAVResource::FetchDeadProperties ( )
protected

Fetch any dead properties for this URL

Definition at line 693 of file DAVResource.php.

◆ FetchParentContainer()

DAVResource::FetchParentContainer ( )

Fetch the parent to this resource. This is deprecated - use GetParentContainer() instead.

Deprecated:

Definition at line 825 of file DAVResource.php.

◆ FetchPrincipal()

DAVResource::FetchPrincipal ( )
protected

Find the principal associated with this resource.

Definition at line 643 of file DAVResource.php.

◆ FetchPrivileges()

DAVResource::FetchPrivileges ( )
protected

Build permissions for this URL

Definition at line 747 of file DAVResource.php.

◆ FetchResource()

DAVResource::FetchResource ( )
protected

Retrieve the actual resource.

Definition at line 666 of file DAVResource.php.

◆ FetchSupportedMethods()

DAVResource::FetchSupportedMethods ( )

Returns the array of supported methods

Definition at line 895 of file DAVResource.php.

◆ FetchSupportedReports()

DAVResource::FetchSupportedReports ( )

Returns the array of supported reports

Definition at line 986 of file DAVResource.php.

◆ FetchTickets()

DAVResource::FetchTickets ( )

Fetches an array of the access_ticket records applying to this path

Definition at line 1041 of file DAVResource.php.

◆ FromPath()

DAVResource::FromPath (   $inpath)

Initialise from a path

Parameters
object$inpathThe path to populate the resource data from

Definition at line 359 of file DAVResource.php.

◆ FromRow()

DAVResource::FromRow (   $row)

Initialise from a database row

Parameters
object$rowThe row from the DB.

Definition at line 223 of file DAVResource.php.

◆ GetACL()

DAVResource::GetACL ( $xmldoc)

Return ACL settings

Definition at line 1492 of file DAVResource.php.

◆ GetParentContainer()

DAVResource::GetParentContainer ( )

Get a DAVResource which is the parent to this resource.

Definition at line 805 of file DAVResource.php.

◆ GetProperty()

DAVResource::GetProperty (   $name)

Return general server-related properties, in plain form

Definition at line 1522 of file DAVResource.php.

◆ GetPropStat()

DAVResource::GetPropStat (   $properties,
$reply,
  $props_only = false 
)

Construct XML propstat fragment for this resource

Parameters
arrayof string $properties The requested properties for this resource
Returns
string An XML fragment with the requested properties for this resource

Definition at line 1964 of file DAVResource.php.

◆ HavePrivilegeTo()

DAVResource::HavePrivilegeTo (   $do_what,
  $any = null 
)

Does the user have the privileges to do what is requested.

Parameters
$do_whatmixed The request privilege name, or array of privilege names, to be checked.
$anyboolean Whether we accept any of the privileges. The default is true, unless the requested privilege is 'all', when it is false.
Returns
boolean Whether they do have one of those privileges against this resource.

Definition at line 846 of file DAVResource.php.

◆ IsAddressbook()

DAVResource::IsAddressbook ( )

Checks whether this resource is an addressbook

Definition at line 1210 of file DAVResource.php.

◆ IsBinding()

DAVResource::IsBinding ( )

Checks whether this resource is a bind to another resource

Definition at line 1218 of file DAVResource.php.

◆ IsCalendar()

DAVResource::IsCalendar ( )

Checks whether this resource is a calendar

Definition at line 1166 of file DAVResource.php.

◆ IsCollection()

DAVResource::IsCollection ( )

Checks whether this resource is a collection

Definition at line 1150 of file DAVResource.php.

◆ IsExternal()

DAVResource::IsExternal ( )

Checks whether this resource is a bind to an external resource

Definition at line 1226 of file DAVResource.php.

◆ IsInSchedulingCollection()

DAVResource::IsInSchedulingCollection (   $type = 'any')

Checks whether this resource is IN a scheduling inbox/outbox collection

Parameters
string$typeThe type of scheduling collection, 'inbox', 'outbox' or 'any'

Definition at line 1199 of file DAVResource.php.

◆ IsLocked()

DAVResource::IsLocked (   $depth = 0)

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.

Find the locks that might apply and load them into an array

Definition at line 1118 of file DAVResource.php.

◆ IsPrincipal()

DAVResource::IsPrincipal ( )

Checks whether this resource is a principal

Definition at line 1158 of file DAVResource.php.

◆ IsProxyCollection()

DAVResource::IsProxyCollection (   $type = 'any')

Checks whether this resource is a proxy collection

Parameters
string$typeThe type of proxy collection, 'read', 'write' or 'any'

Definition at line 1175 of file DAVResource.php.

◆ IsPublic()

DAVResource::IsPublic ( )

Checks whether the target collection is publicly_readable

Definition at line 1421 of file DAVResource.php.

◆ IsPublicOnly()

DAVResource::IsPublicOnly ( )

Checks whether the target collection is for public events only

Definition at line 1429 of file DAVResource.php.

◆ IsSchedulingCollection()

DAVResource::IsSchedulingCollection (   $type = 'any')

Checks whether this resource is a scheduling inbox/outbox collection

Parameters
string$typeThe type of scheduling collection, 'inbox', 'outbox' or 'any'

Definition at line 1187 of file DAVResource.php.

◆ NeedPrivilege()

DAVResource::NeedPrivilege (   $privilege,
  $any = null 
)

Check if we have the needed privilege or send an error response. If the user does not have the privileges then the call will not return, and an XML error document will be output.

Parameters
string$privilegeThe name of the needed privilege.
boolean$anyWhether we accept any of the privileges. The default is true, unless the requested privilege is 'all', when it is false.

Definition at line 868 of file DAVResource.php.

◆ parent_path()

DAVResource::parent_path ( )

Returns the dav_name of the resource in our internal namespace

Definition at line 1308 of file DAVResource.php.

◆ principal_url()

DAVResource::principal_url ( )

Returns the principal-URL for this resource

Definition at line 1324 of file DAVResource.php.

◆ Privileges()

DAVResource::Privileges ( )

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

Definition at line 834 of file DAVResource.php.

◆ ReadCollectionFromDatabase()

DAVResource::ReadCollectionFromDatabase ( )
private

Definition at line 376 of file DAVResource.php.

◆ RenderAsXML()

DAVResource::RenderAsXML (   $properties,
$reply,
  $bound_parent_path = null 
)

Render XML for this resource

Parameters
array$propertiesThe requested properties for this principal
reference$replyA reference to the XMLDocument being used for the reply
Returns
string An XML fragment with the requested properties for this principal

Definition at line 2022 of file DAVResource.php.

◆ resource()

array An array of the component types we support on this DAVResource::resource ( )

Returns the database row for this resource

Definition at line 1360 of file DAVResource.php.

◆ resource_id()

DAVResource::resource_id ( )

Returns the definitive resource_id for this resource - usually a dav_id

Definition at line 1386 of file DAVResource.php.

◆ ResourceProperty()

DAVResource::ResourceProperty (   $tag,
  $prop,
$reply,
$denied 
)

Return general server-related properties for this URL

getlastmodified is HTTP Date format: i.e. the Last-Modified header in response to a GET

creationdate is ISO8601 format

indicating the style for future expansion

Definition at line 1621 of file DAVResource.php.

◆ set_bind_location()

DAVResource::set_bind_location (   $new_dav_name)

Sets the dav_name of the resource we are bound as

Definition at line 1296 of file DAVResource.php.

◆ sync_token()

DAVResource::sync_token (   $cachedOK = true)

Returns the current sync_token for this collection, or the containing collection

Definition at line 1400 of file DAVResource.php.

◆ timezone_name()

DAVResource::timezone_name ( )

Returns the name of the timezone for this collection, or the collection containing this resource

Definition at line 1351 of file DAVResource.php.

◆ unique_tag()

DAVResource::unique_tag ( )

Returns the unique_tag (ETag or getctag) for this resource

Definition at line 1369 of file DAVResource.php.

◆ url()

DAVResource::url ( )

Returns the URL of our resource

Returns
string

Definition at line 1265 of file DAVResource.php.

◆ user_no()

DAVResource::user_no ( )

Returns the internal user_no for the principal for this resource

Definition at line 1333 of file DAVResource.php.

Member Data Documentation

◆ $_collection_is_cacheable

DAVResource::$_collection_is_cacheable
private

Definition at line 165 of file DAVResource.php.

◆ $_is_addressbook

DAVResource::$_is_addressbook
private

Definition at line 109 of file DAVResource.php.

◆ $_is_binding

DAVResource::$_is_binding
private

Definition at line 99 of file DAVResource.php.

◆ $_is_calendar

DAVResource::$_is_calendar
private

Definition at line 94 of file DAVResource.php.

◆ $_is_collection

DAVResource::$_is_collection
private

Definition at line 84 of file DAVResource.php.

◆ $_is_external

DAVResource::$_is_external
private

Definition at line 104 of file DAVResource.php.

◆ $_is_principal

DAVResource::$_is_principal
private

Definition at line 89 of file DAVResource.php.

◆ $_is_proxy_resource

DAVResource::$_is_proxy_resource
private

Definition at line 114 of file DAVResource.php.

◆ $access_tickets

DAVResource::$access_tickets
private

Definition at line 154 of file DAVResource.php.

◆ $bound_from

DAVResource::$bound_from
protected

Definition at line 64 of file DAVResource.php.

◆ $collection

DAVResource::$collection
private

Definition at line 69 of file DAVResource.php.

◆ $collection_type

DAVResource::$collection_type
private

Definition at line 146 of file DAVResource.php.

◆ $contenttype

DAVResource::$contenttype
protected

Definition at line 59 of file DAVResource.php.

◆ $created

DAVResource::$created
private

Definition at line 147 of file DAVResource.php.

◆ $dav_name

DAVResource::$dav_name
protected

Definition at line 29 of file DAVResource.php.

◆ $dead_properties

DAVResource::$dead_properties
private

Definition at line 134 of file DAVResource.php.

◆ $displayname

DAVResource::$displayname
private

Definition at line 148 of file DAVResource.php.

◆ $exists

DAVResource::$exists
protected

Definition at line 34 of file DAVResource.php.

◆ $modified

DAVResource::$modified
private

Definition at line 149 of file DAVResource.php.

◆ $parent

DAVResource::$parent
protected

Definition at line 49 of file DAVResource.php.

◆ $parent_container_type

DAVResource::$parent_container_type
private

Definition at line 155 of file DAVResource.php.

◆ $path_privs

DAVResource::$path_privs
private

Definition at line 150 of file DAVResource.php.

◆ $principal

DAVResource::$principal
private

Definition at line 74 of file DAVResource.php.

◆ $principal_id

DAVResource::$principal_id
private

Definition at line 151 of file DAVResource.php.

◆ $privileges

DAVResource::$privileges
private

Definition at line 79 of file DAVResource.php.

◆ $proxy_type

DAVResource::$proxy_type
private

Definition at line 119 of file DAVResource.php.

◆ $resource

DAVResource::$resource
protected

Definition at line 44 of file DAVResource.php.

◆ $resource_id

DAVResource::$resource_id
private

Definition at line 152 of file DAVResource.php.

◆ $resourcetypes

DAVResource::$resourcetypes
protected

Definition at line 54 of file DAVResource.php.

◆ $supported_components

DAVResource::$supported_components
private

Definition at line 139 of file DAVResource.php.

◆ $supported_methods

DAVResource::$supported_methods
private

Definition at line 124 of file DAVResource.php.

◆ $supported_reports

DAVResource::$supported_reports
private

Definition at line 129 of file DAVResource.php.

◆ $sync_token

DAVResource::$sync_token
private

Definition at line 156 of file DAVResource.php.

◆ $tickets

DAVResource::$tickets
private

Definition at line 144 of file DAVResource.php.

◆ $unique_tag

DAVResource::$unique_tag
protected

Definition at line 39 of file DAVResource.php.

◆ $user_no

DAVResource::$user_no
private

Definition at line 153 of file DAVResource.php.


The documentation for this class was generated from the following file: