Removal of users
From 0.9.7.3 there is a button to delete users in the administrative interface, so the rest of this page is rather historical from that point.
How it used to be
Deleting Users with a Script
Deleting Calendars with a DAV Client
It is possible to use a DAV client like
cadaver to delete a calendar. I don't know of any CalDAV client which implements deletion of remote calendars (delete usually only removes the connection information), but the functionality is implemented in DAViCal.
Deleting Users with SQL
While there is no functionality to delete a user or a calendar through the admin user interface in DAViCal, the tasks can be done through SQL.
BEGIN; DELETE FROM relationship WHERE to_user = (SELECT user_no FROM usr WHERE username='someuser'); DELETE FROM relationship WHERE from_user = (SELECT user_no FROM usr WHERE username='someuser'); DELETE FROM collection WHERE user_no = (SELECT user_no FROM usr WHERE username='someuser'); DELETE FROM property WHERE dav_name LIKE '/someuser/%'; DELETE FROM usr WHERE username = 'someuser'; COMMIT;
In some circumstances this won't work completely, because the user will have modified appointments in other calendars. A decision will need to be made to modify or delete those appointments in order to pass the relational integrity check.
To list the entries changed by a particular user, something like the following:
SELECT * FROM caldav_data WHERE logged_user = (SELECT user_no FROM usr WHERE username='someuser');
If you want to delete a single user, the SQL commands above will do it. Since I was in need of a more efficient way, I wrote a little script (davical_deluser) to help me with that. Read the head of the script for instructions.
Emptying a Calendar with SQL
To delete just the events in a particular calendar:
DELETE FROM caldav_data WHERE dav_name = '/username/calendar/';
A database trigger will remove the related entries from the calendar_item table.
Deleting a Calendar with SQL
To delete a calendar:
DELETE FROM collection WHERE dav_name = '/username/calendar/';