mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-30 18:37:12 +00:00
Introduce a rudimentary 'principal' attribute to the request object.
This commit is contained in:
parent
56ce8b230e
commit
9bb9141f56
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user