From 9bb9141f562a22a9f5112cd02621eb20c350ad8a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 26 Oct 2007 21:11:19 +1300 Subject: [PATCH] Introduce a rudimentary 'principal' attribute to the request object. --- inc/CalDAVRequest.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index d5f4c7c4..cfc6983a 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -27,6 +27,17 @@ class CalDAVRequest { var $options; + /** + * 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. + */ + var $depth; + + /** + * The 'principal' (user/resource/...) which this request seeks to access + */ + var $principal; + /** * Create a new CalDAVRequest object. */ @@ -34,6 +45,7 @@ class CalDAVRequest global $session, $c, $debugging; $this->options = $options; + $this->principal = (object) array( 'username' => $session->username, 'user_no' => $session->user_no ); $this->raw_post = file_get_contents ( 'php://input'); @@ -140,8 +152,11 @@ class CalDAVRequest /** * Extract the user whom we are accessing + * TODO: Replace this by something which properly sets up the DAV 'principal' */ $this->UserFromPath(); + $this->principal->url = sprintf( "%s/%s/", $c->protocol_server_port_script, $this->principal->username); + $this->principal->calendar_home_set = sprintf( "%s/%s/%s/", $c->protocol_server_port_script, $this->principal->username, $c->home_calendar_name); /** * Evaluate our permissions for accessing the target @@ -200,7 +215,8 @@ class CalDAVRequest $this->user_no = $user->user_no; } } - elseif( $user = getUserByName($this->username,'caldav',__LINE__,__FILE__)){ + elseif( $user = getUserByName($this->username,'caldav',__LINE__,__FILE__)) { + $this->principal = $user; $this->user_no = $user->user_no; } }