Skip to content

Commit

Permalink
Add CalDAV Support for system shares in nag and kronolith for Request…
Browse files Browse the repository at this point in the history
… #12342.

This does not address CardDAV and Turba yet, but it is probably very similar.
Note I have not a very deep understanding of CardDAV or CalDAV protocol.
  • Loading branch information
ralflang committed Jul 11, 2013
1 parent 7da7a1a commit 1e33278
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 5 deletions.
19 changes: 16 additions & 3 deletions framework/Dav/lib/Horde/Dav/Principals.php
Expand Up @@ -64,7 +64,7 @@ public function getPrincipalsByPrefix($prefixPath)
if ($prefixPath != 'principals') {
throw new DAV\Exception\NotFound('Invalid principal prefix path ' . $prefixPath);
}
$users = array();
$users = array($this->_getUserInfo('-system-'));
if (!$this->_auth->hasCapability('list')) {
return $users;
}
Expand All @@ -87,7 +87,8 @@ public function getPrincipalByPath($path)
throw new DAV\Exception\NotFound('Invalid principal prefix path ' . $prefix);
}
if ($this->_auth->hasCapability('list') &&
!$this->_auth->exists($user)) {
!$this->_auth->exists($user) &&
$user != '-system-') {
throw new DAV\Exception\NotFound('User ' . $user . ' does not exist');
}
return $this->_getUserInfo($user);
Expand All @@ -102,6 +103,16 @@ public function getPrincipalByPath($path)
*/
protected function _getUserInfo($user)
{
if ($user == '-system-') {
return array(
'uri' => 'principals/-system-',
'{DAV:}displayname' => '-systems-',
'{http://sabredav.org/ns}email-address' => ''
/* Should we leave this empty, set something static
or pull something from config ? */
);
}

$identity = $this->_identities->create($user);
return array(
'uri' => 'principals/' . $user,
Expand Down Expand Up @@ -154,7 +165,9 @@ public function getGroupMemberSet($principal)
*/
public function getGroupMembership($principal)
{
return array();
// All users should have access to the -system- share
// Which should return only calendars the user sees in Horde.
return array('principals/-system-');
}

/**
Expand Down
2 changes: 2 additions & 0 deletions framework/Dav/package.xml
Expand Up @@ -22,6 +22,7 @@
</stability>
<license uri="http://www.horde.org/licenses/bsd">BSD-2-Clause</license>
<notes>
* [rla] Add system share support for CalDAV (Request #12342).
* [jan] Fix PUTing content from the input stream to the backend.
* [jan] Update to SabreDAV 1.8.6.
</notes>
Expand Down Expand Up @@ -669,6 +670,7 @@
<date>2013-06-04</date>
<license uri="http://www.horde.org/licenses/bsd">BSD-2-Clause</license>
<notes>
* [rla] Add system share support for CalDAV (Request #12342).
* [jan] Fix PUTing content from the input stream to the backend.
* [jan] Update to SabreDAV 1.8.6.
</notes>
Expand Down
1 change: 1 addition & 0 deletions kronolith/docs/CHANGES
Expand Up @@ -2,6 +2,7 @@
v4.1.2-git
----------

[rla] Add system calendar support for Kronolith CalDAV access (Request #12342).
[mjr] Fix automatically adding organizer as attendee in dynamic view.
[mjr] Prompt for sending cancellation iTip when deleting an event (Bug #12415).
[rla] Properly display system-owned calendars when browsing DAV (Bug #12325).
Expand Down
6 changes: 5 additions & 1 deletion kronolith/lib/Application.php
Expand Up @@ -661,17 +661,21 @@ public function cleanupData()
*/
public function davGetCollections($user)
{
$queryUser = $user == '-system-' ? '' : $user;
$shares = $GLOBALS['injector']
->getInstance('Kronolith_Shares')
->listShares(
$GLOBALS['registry']->getAuth(),
array('perm' => Horde_Perms::SHOW,
'attributes' => $user)
'attributes' => $queryUser)
);
$dav = $GLOBALS['injector']
->getInstance('Horde_Dav_Storage');
$calendars = array();
foreach ($shares as $id => $share) {
if (empty($queryUser) && $share->get('owner')) {
continue;
}
try {
$id = $dav->getExternalCollectionId($id, 'calendar');
} catch (Horde_Dav_Exception $e) {
Expand Down
2 changes: 2 additions & 0 deletions kronolith/package.xml
Expand Up @@ -34,6 +34,7 @@
</stability>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [rla] Add system calendar support for Kronolith CalDAV access (Request #12342).
* [mjr] Fix automatically adding organizer as attendee in dynamic view.
* [mjr] Prompt for sending cancellation iTip when deleting an event (Bug #12415).
* [rla] Properly display system-owned calendars when browsing DAV (Bug #12325).
Expand Down Expand Up @@ -2185,6 +2186,7 @@
<date>2013-06-18</date>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [rla] Add system calendar support for Kronolith CalDAV access (Request #12342).
* [mjr] Fix automatically adding organizer as attendee in dynamic view.
* [mjr] Prompt for sending cancellation iTip when deleting an event (Bug #12415).
* [rla] Properly display system-owned calendars when browsing DAV (Bug #12325).
Expand Down
1 change: 1 addition & 0 deletions nag/docs/CHANGES
Expand Up @@ -2,6 +2,7 @@
v4.1.1-git
----------

[rla] Add system tasklist support for Nag CalDAV access (Request #12342).
[jan] Fix task description tooltip (Bug #12421).
[mjr] Persist the tasklist and parent when creating a new task and using "Save
and New" (Bug: 12400).
Expand Down
6 changes: 5 additions & 1 deletion nag/lib/Application.php
Expand Up @@ -421,16 +421,20 @@ public function cleanupData()
*/
public function davGetCollections($user)
{
$queryUser = $user == '-system-' ? '' : $user;
$shares = $GLOBALS['nag_shares']
->listShares(
$GLOBALS['registry']->getAuth(),
array('perm' => Horde_Perms::SHOW,
'attributes' => $user)
'attributes' => $queryUser)
);
$dav = $GLOBALS['injector']
->getInstance('Horde_Dav_Storage');
$tasklists = array();
foreach ($shares as $id => $share) {
if (empty($queryUser) && $share->get('owner')) {
continue;
}
try {
$id = $dav->getExternalCollectionId($id, 'tasks') ?: $id;
} catch (Horde_Dav_Exception $e) {
Expand Down
2 changes: 2 additions & 0 deletions nag/package.xml
Expand Up @@ -34,6 +34,7 @@
</stability>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [rla] Add system tasklist support for Nag CalDAV access (Request #12342).
* [jan] Fix task description tooltip (Bug #12421).
* [mjr] Persist the tasklist and parent when creating a new task and using "Save and New" (Bug: 12400).
* [mjr] Fix tag browsing of shared tasklists (Bug #12405).
Expand Down Expand Up @@ -1388,6 +1389,7 @@
<date>2013-06-05</date>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [rla] Add system tasklist support for Nag CalDAV access (Request #12342).
* [jan] Fix task description tooltip (Bug #12421).
* [mjr] Persist the tasklist and parent when creating a new task and using "Save and New" (Bug: 12400).
* [mjr] Fix tag browsing of shared tasklists (Bug #12405).
Expand Down

0 comments on commit 1e33278

Please sign in to comment.