Difference between revisions of "Removal of users"

From Davical
Jump to navigationJump to search
(Provide some ways to delete users & calendars)
(Recommended approach)
Line 1: Line 1:
Removal of users is a function that I'm missing. It is a feature that prevents davical from really good use. It prevents removing old users that has fallen out of time. By users in this case I'm referring to system users regardless of user role.
+
At present there is no functionality in the administrative interface to delete users or calendars.
  
This feature is also important while setting up and understanding the basic semantics behind davical. This since you will need to laborate with and maybe not wanting to rename or wiping the database just because you added some users to many.
+
The recommended approach is to mark users as inactive, rather than delete them.
 
 
Now I understand that deletion is a delicate thing, you wouldn't want any user to be able to do removal of users since it can mess things up really good.
 
:I guess the best and simplest way to do this would be to mark the user as inactive and as having no roles, etc.
 
  
 
== Deleting Calendars with a DAV Client ==
 
== Deleting Calendars with a DAV Client ==

Revision as of 02:34, 18 September 2008

At present there is no functionality in the administrative interface to delete users or calendars.

The recommended approach is to mark users as inactive, rather than delete them.

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');

Deleting a Calendar with SQL

To delete a calendar:

DELETE FROM collection WHERE dav_name = '/username/calendar/';