Skip to content

Commit

Permalink
Fix for CalDAV servers placed on relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgelzpz committed Oct 8, 2012
1 parent 63480dd commit d8cf945
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
32 changes: 25 additions & 7 deletions doc/source/admin/configuration.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -306,7 +306,13 @@ Here you will configure every single aspect of your CalDAV server.


.. confval:: caldav_base_url .. confval:: caldav_base_url


Base CalDAV URL used to build all CalDAV URLs Base CalDAV URL used to build all CalDAV URLs. If your CalDAV server is located under a relative path don't specify
it here. Do not add trailing slash.

Examples::

// This will work for CalDAV servers placed on root URL or under any relative path
$config['caldav_base_url'] = 'http://my.caldav.server';


.. versionadded:: 1.3.0 .. versionadded:: 1.3.0


Expand Down Expand Up @@ -342,52 +348,64 @@ Here you will configure every single aspect of your CalDAV server.


This is just a path, not a full URL. Your :confval:`caldav_base_url` will be prepended to this value. This is just a path, not a full URL. Your :confval:`caldav_base_url` will be prepended to this value.


Remember to add the relative path to your CalDAV server if it's not located under your root URL.

Needs a trailing slash. Needs a trailing slash.


Example:: Example::


// Example 1: DAViCal // Example 1: DAViCal
$config['caldav_principal_template'] = '/caldav.php/%u/'; $config['caldav_principal_template'] = '/caldav.php/%u/';


// Example 2: SabreDAV // Example 2: DAViCal on http://my.caldav.server/davical/...
$config['caldav_principal_template'] = '/davical/caldav.php/%u/';

// Example 3: SabreDAV
$config['caldav_principal_template'] = '/calendarserver.php/principals/%u/'; $config['caldav_principal_template'] = '/calendarserver.php/principals/%u/';


// Example 3: Calendar server // Example 4: Calendar server
$config['caldav_principal_template'] = '/calendars/users/%u/'; $config['caldav_principal_template'] = '/calendars/users/%u/';


.. versionadded:: 1.3.0 .. versionadded:: 1.3.0


.. seealso:: :confval:`caldav_calendar_homeset_template` .. seealso:: :confval:`caldav_base_url` and :confval:`caldav_calendar_homeset_template`


.. confval:: caldav_calendar_homeset_template .. confval:: caldav_calendar_homeset_template


Used by AgenDAV to search for calendars for current user. ``%u`` will be replaced with a username. Used by AgenDAV to search for calendars for current user. ``%u`` will be replaced with a username.


This is just a path, not a full URL. Your :confval:`caldav_base_url` will be prepended to this value. This is just a path, not a full URL. Your :confval:`caldav_base_url` will be prepended to this value.


Remember to add the relative path to your CalDAV server if it's not located under your root URL.

Example:: Example::


// DAViCal // DAViCal
$config['caldav_calendar_homeset_template'] = '/caldav.php/%u/'; $config['caldav_calendar_homeset_template'] = '/caldav.php/%u/';

// DAViCal under /davical
$config['caldav_calendar_homeset_template'] = '/davical/caldav.php/%u/';
.. versionadded:: 1.3.0 .. versionadded:: 1.3.0


.. seealso:: :confval:`caldav_base_url` .. seealso:: :confval:`caldav_base_url` and :confval:`caldav_principal_template`


.. confval:: caldav_public_base_url .. confval:: caldav_public_base_url


The base URL that will be shown to users if :confval:`show_public_caldav_url` is The base URL that will be shown to users if :confval:`show_public_caldav_url` is
enabled. It's not used for internal connections. enabled. It's not used for internal connections.


If your CalDAV server is located under a relative path don't specify it here. Do not add trailing slash.

Do not add a trailing slash. Do not add a trailing slash.


Example:: Example::


$config['public_caldav_url'] = 'https://public.caldav.tld'; $config['public_caldav_url'] = 'https://public.caldav.tld';


Will become for user ``user2`` and calendar ``myhomecalendar``: For a DAViCal server placed on /davical will become for user ``user2`` and calendar ``myhomecalendar``:


https://public.caldav.tld/caldav.php/user2/myhomecalendar/ https://public.caldav.tld/davical/caldav.php/user2/myhomecalendar/


.. confval:: enable_calendar_sharing .. confval:: enable_calendar_sharing


Expand Down
9 changes: 9 additions & 0 deletions web/config/caldav.php.template
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ $config['caldav_http_auth_method'] = null;
* This URL will be used to build the rest of URLs (principals and * This URL will be used to build the rest of URLs (principals and
* calendars) * calendars)
* *
* If your CalDAV server is placed under a relative path, don't specify it here
*
* Please, do NOT add trailing slash * Please, do NOT add trailing slash
*/ */


Expand All @@ -51,10 +53,13 @@ $config['caldav_base_url'] = 'http://caldav.server';
* *
* Do not use a full URL, use a relative path to be appended to your caldav_base_url * Do not use a full URL, use a relative path to be appended to your caldav_base_url
* *
* Remember to add your CalDAV server relative path if needed
*
* %u will be replaced by an username. Please, add trailing slash * %u will be replaced by an username. Please, add trailing slash
* *
* Some examples: * Some examples:
* - DAViCal: /caldav.php/%u/ * - DAViCal: /caldav.php/%u/
* - DAViCal under non-root path: /davical/caldav.php/%u/
* - SabreDAV: /calendarserver.php/principals/%u/ * - SabreDAV: /calendarserver.php/principals/%u/
* - Apple Calendar Server: /users/%u/ * - Apple Calendar Server: /users/%u/
*/ */
Expand All @@ -67,11 +72,14 @@ $config['caldav_principal_template'] = '/caldav.php/%u/';
* *
* Do not use a full URL, use a relative path to be appended to your caldav_base_url * Do not use a full URL, use a relative path to be appended to your caldav_base_url
* *
* Remember to add your CalDAV server relative path if needed
*
* %u will be replaced by an username. Please, add trailing slash * %u will be replaced by an username. Please, add trailing slash
* *
* Some samples: * Some samples:
* *
* - DAViCal: /caldav.php/%u/ * - DAViCal: /caldav.php/%u/
* - DAViCal under non-root path: /davical/caldav.php/%u/
* - SabreDAV: /calendarserver.php/calendars/%u/ * - SabreDAV: /calendarserver.php/calendars/%u/
* - Apple Calendar Server: /calendars/users/%u/ * - Apple Calendar Server: /calendars/users/%u/
*/ */
Expand All @@ -83,6 +91,7 @@ $config['caldav_calendar_homeset_template'] = '/caldav.php/%u/';
* ==================================== * ====================================
* *
* Please, do NOT add trailing slash. * Please, do NOT add trailing slash.
* If your CalDAV server is placed under a relative path, don't specify it here
* Will be shown to users only when 'show_public_caldav_url' is enabled * Will be shown to users only when 'show_public_caldav_url' is enabled
*/ */


Expand Down
6 changes: 3 additions & 3 deletions web/lib/AgenDAV/CalDAV/CURLClient.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ public function __construct($app_user, IURLGenerator $urlgenerator, $logger, $op
} }


/** /**
* Checks current user authentication against provided * Checks current user authentication against current user principal URL
* *
* @param string $url * @param string $url
* @access public * @access public
* @return boolean * @return boolean
*/ */
public function checkAuthentication($url = '/') public function checkAuthentication()
{ {
return $this->CheckValidCalDAV($url); return $this->CheckValidCalDAV($this->PrincipalURL());
} }


/** /**
Expand Down
5 changes: 2 additions & 3 deletions web/lib/AgenDAV/CalDAV/ICalDAVClient.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@
interface ICalDAVClient interface ICalDAVClient
{ {
/** /**
* Checks current user authentication against provided * Checks current user authentication against current user principal URL
* *
* @param string $url
* @access public * @access public
* @return boolean * @return boolean
*/ */
public function checkAuthentication($url = '/'); public function checkAuthentication();


/** /**
* Checks if provided resource is accesible for current user * Checks if provided resource is accesible for current user
Expand Down

0 comments on commit d8cf945

Please sign in to comment.