[horde] deleting users from the database

Andrew Morgan morgan at orst.edu
Fri Oct 31 13:14:24 PST 2003


On Fri, 31 Oct 2003, Eric Rostetter wrote:

> Does anyone have any kind of scripts or documentation on how to remove users
> from the various Horde sql database tables when (for example) their account is
> deleted from your system?
>
> I've just recently deleted a bunch of accounts on my system, most of which
> used Horde/IMP/etc and hence have database records I want to remove.  I'm
> sure with time I'll find out all the tables and stuff to modify, but if any
> one has already done this and can save me some time...
>
> Sounds like another documentation project just waiting to happen ;)

Here is a fragment of perl that we use to clear out the webmail databases
when an account is deleted:

        #########################
        # Clean out webmail database
        #########################
        $webmail_dbh->do("DELETE FROM turba_objects
                        WHERE owner_id = '$username\@onid.orst.edu'");
        $webmail_dbh->do("DELETE FROM horde_prefs
                        WHERE pref_uid = '$username\@onid.orst.edu'");
        $webmail_dbh->do("DELETE FROM kronolith_events
                        WHERE calendar_id = '$username\@onid.orst.edu'");


Obviously, change the realm from "onid.orst.edu" to whatever your site
uses.

We're running Horde, IMP, Kronolith, and Turba, so there may be more
tables to clean out if you are running other Horde modules.

	Andy




More information about the horde mailing list