My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
CalDAV  
CalDAV support information
CalDAV, Featured
Updated Jan 24, 2012 by marclaporte

Installation

CalDAV support comes in a separate package. If you installed the zip file, you should already have the CalDAV source files. If you installed SabreDAV using pear, you might need to install it using the following command:

pear install sabredav/Sabre_CalDAV

Database setup

Example sql files are supplied for postgres, sqlite and mysql. The latter two are officially supported and unittested.

This example assumes you're using sqlite.

Create a 'data' directory where you're going to store the sqlite database.

mkdir data/
cat examples/sql/sqlite.* | sqlite3 data/db.sqlite

We'll add a calendar for the admin user.

INSERT INTO calendars (principaluri, displayname, uri, description, components, ctag) VALUES
('principals/admin','default calendar','default','','VEVENT,VTODO','1');

Now, make sure the data/db.sqlite as well as it's containing directory are writable by the server. If you are lazy you could just do:

chmod -Rv a+rw data/

Create the server endpoint

Simply run the following:

cp examples/calendarserver.php calendarserver.php

Test in browser

Try opening the full url to your new server. Make sure you append a slash at the end of the url, without this the request will fail. Example:

http://www.example.org/~every/sabredav/calendarserver.php/

This url should prompt you with an authentication dialog. The default username and password are admin and admin.

Now you can use the url:

http://www.example.org/~every/sabredav/calendarserver.php/principals/admin/

for iCal and iPhone, or

http://www.example.org/~every/sabredav/calendarserver.php/calendars/admin/default

For Lightning or Evolution.

Note that the iCal and iPhone clients can auto-detect the principal url, if SabreDAV runs at the root of the domain.

Adding users

SabreDAV does not provide an administrative interface. While this may happen in the future, for now SabreDAV is mostly intended for developers. Adding new users is done directly on the database.

In order to allow a user to log in, add them to the users table. You must also add them to the principals table to enable calendar access.

Lastly, in order to enable support for calendar-delegation, the calendar-proxy-read and calendar-proxy-write principals must be added. Look at the sample .sql files for examples for these records.

Related topics

Comment by je...@sar.nl, Feb 26, 2010

What kind of hash do I need for the password in de users table?

Comment by project member evert...@gmail.com, Feb 26, 2010
//example:
$username = 'admin';
$password = 'password';

$hash = md5($username . ':SabreDAV:' . $password);

This is a standard HTTP Digest hash. Since the realm is currently hardcoded it's always SabreDAV.

Comment by je...@sar.nl, Feb 26, 2010

Thanks! BTW, are you Dutch? ("Evert")

Comment by project member evert...@gmail.com, Feb 26, 2010

Yep! Born and raised =)

Comment by je...@sar.nl, Feb 26, 2010

Oke, mag ik dan een vraag in het Nederland stellen?

Als ik meerdere users toevoeg en daaraan calendars toevoeg kunnen die gebruikers bij elkaars calendars. Hoe zorg ik ervoor dat dit niet kan?

Comment by project member evert...@gmail.com, Feb 26, 2010

T: When multiple users are added, these can access each others calendars.

There's unfortunately no security yet built in at all. If you can log in, you can see everything and you can edit everything. These things will be locked down in a later version, focus is just on the actual protocol for now.

Comment by project member evert...@gmail.com, Feb 26, 2010

P.S. Sorry for the english, but this is primarily an english site. You can by the way also try the mailing list for any questions http://groups.google.com/group/sabredav-discuss

Comment by je...@sar.nl, Feb 27, 2010

Okay, one last question:

I'm owner of a hosting company, and I want to offer CalDAV hosting for my clients. I wanted to use this CalDAV 'framework', but it is still in beta and because there's no security, i'm now searching for another good (PHP) CalDAV framework, do you know one?

(P.S.: from now on I will post my questions to the mailinglist ;-) )

Comment by jtiet...@gmail.com, May 17, 2010

The SQL insert statement doesn't seem to be valid. It has 5 columns but only 4 values.

Comment by project member evert...@gmail.com, May 17, 2010

jtietema,

You're correct. Just fixed that. Thanks for pointing it out

Comment by sven@e7o.de, May 21, 2010

Nice project.

I tried to get the calendar server running but get this error:

<d:error>

<s:exception>Sabre_DAV_Exception_FileNotFound?</s:exception> <s:message>File not found: calendarserver.php</s:message> <s:sabredav-version>1.2.0beta3</s:sabredav-version>
</d:error>

I tried to place the calendarserver.php everywhere but no success :(

Comment by project member evert...@gmail.com, May 21, 2010

Hi Sven, The calendarserver.php needs to be opened directly. Try opening calendarserver.php in the browser.

If you want to run the calendar server on the root of your domain, open calendarserver.php and change the 'baseUri'.

Comment by sven@e7o.de, May 24, 2010

Hi evert, thanks you for your answer.

I opened http://localhost/_system/SabreDAV/calendarserver.php/ directly (with / like it's descripted) and set $baseUri = '/system/SabreDAV/'; (without trailing slash I get Sabre_DAV_Exception_Forbidden?, without last slash the known filenotfound). Maybee there's something wrong?

Comment by project member evert...@gmail.com, May 24, 2010

Hi Sven,

The baseUri in this case should be: /system/SabreDAV/calendarserver.php/

If you want a 'nice' url, you can change this with mod_rewrite.

Let me know if that works, and also hit me up on the mailing list for anything else.

Comment by sven@e7o.de, May 25, 2010

Hi, thank you for your prompt help! It's working now... Maybee I was confused by this line:

// $baseUri = '/';

I removed the // and changed directory to /system/SabreDAV/ - and I didn't read the comment above this line exactly :( Maybee it's a good idea to change the comment to

// $baseUri = '/calendarserver.php/';

:)

Comment by michael....@gmail.com, Jul 15, 2010

I'm currently installing CalDAV, and I followed all directions. I can open http://server/calendarserver.php/ and there is a authentication dialog. But after filling in admin:admin I get "SQLSTATEHY000?: General error: 1 no such table: users" I just checked the sqlite.calendars.sql file and there is no table "users" created. So I am missing some SQL queries.

I'm using SabreDAV-1.2.4 via pear. In Version 1.2.3 I saw 3 files in examples/sql/sqlite., in version 1.2.4 there is only one. I think that is the problem here.

Comment by michael....@gmail.com, Jul 15, 2010

Ah, I found the missing files, they are in Sabre_DAV/examples/sql and not in Sabre_CalDAV/examples/sql where I expected them.

Another little thing: In calendarserver.php I had to change require_once 'lib/Sabre/autoload.php'; to require_once 'Sabre/autoload.php'; to get it working.

After fixing that it works really good, great work!

Comment by project member evert...@gmail.com, Jul 15, 2010

Glad you figured it out.

Basically the PEAR packages are composed of parts of the standard directory tree. Because of this, the sql scripts get spread out a bit. It made the most sense to me at the time, but I could also just duplicate the user and lock sql files so it also appears in the CalDAV package.

Comment by techiefr...@gmail.com, Aug 19, 2010

This is great! I got everything working fine...

except.. I have a few questions.

1. What is "principals" used for?

2. why cant I create a folder inside "principals" or "calendars" for that matter. (I get "Sabre_DAV_Exception_Forbidden? Permission denied to create directory 1.2.5")

3. Where is CALENDARCOLOR, and DISPLAYNAME used?

4. What is CTAG?

None of it really matters, as the current setup fits my needs just fine, I'm just curious.

Comment by project member evert...@gmail.com, Aug 19, 2010

Hi Techiefreak,

Definitely ask any followup questions in the mailing list.

1. part of the standard, and used my ical to determine where a users' calendars are, and the identity of the user. 2. Simply didn't build the mechanism for that. It wasn't needed anyway. Those folders aren't 'real folders'. 3. CalendarColor? is a proprietary ical extension. Displayname is used by ical, but might also be used by some other clients. 4. Ctag is used to determine if the entire calendar changed (much like an etag for a single object.) It speeds up the syncing process if nothing changed.

Comment by oma...@gmail.com, Dec 15, 2010

hello all! great small project.

I can't login with admin/admin after the creation of the tables (calendarserver.php). I already recreated the md5 hash in the field digesta1 for the user admin.

thank you for your contribution

Comment by project member evert...@gmail.com, Dec 15, 2010

Hi Omat,

The mailing list is the place to go for any questions.

There's been issues with digest on certain webservers. Some of the mangle the realm which causes the hash to be incorrect.

Comment by jhansonw...@gmail.com, Dec 15, 2010

shouldn't

chmod -Rv a+rw data/ be chmod -Rv a+rw examples/sql

Comment by project member evert...@gmail.com, Dec 15, 2010

jhansonworld,

No, the data directory will contain the sqlite database in this example.

Comment by mariano...@gmail.com, Nov 2, 2011

Hello,

Is there a way to get calendar objects in a specific range of time (e.g., a specific month, etc)? Since the calendar data are stored as blobs, I thought is there an api that can do queries with specific event data such as date? Thanks very much.

Comment by christ...@ch-sc.de, Nov 16, 2011

Hi, I'm not sure what I did wrong, but I get this, when I open calendarserver.php: <d:error><s:exception>PDOException</s:exception><s:message>SQLSTATEHY000?: General error: 1 no such table: users</s:message><s:sabredav-version>1.5.4</s:sabredav-version></d:error>

I got the sqlfile from here: https://github.com/evert/SabreDAV/blob/master/examples/sql/sqlite.calendars.sql

It doesn't contain a user table, so I'm not sure if it just misses, or if I'm supposed to add it myself. And if i have to add it myself, which fields are needed?

Greetings Christian

Comment by project member evert...@gmail.com, Nov 16, 2011

There is also a 'users' sql file in that directory. You'll need that, as well as principals.

Please head to the mailing list for any followup questions.

Comment by t...@geistinteractive.com, Mar 20, 2012

I was able to get this to work with iCal, by using the following url http://caldav.dev/index.php/principals/admin/ where http://caldav.dev/index.php is the url to the server entry point.


Sign in to add a comment
Powered by Google Project Hosting