Author Topic: delete user in the roundcube table after delete from postfixadmin  (Read 12092 times)

Offline dimago

  • Jr. Member
  • **
  • Posts: 33
Hello All,

I was thinking about to delete the user database after delete user from postfixadmin.

So, I create users by postfixadmin. Its works fine. The user is inserted in the mail database. When I logging in the webmail, the user and others informations is inserted in the webmail database, right?

So, when I remove a user from postfixadmin, its removed from mail database, but in the webmail database doesn´t. I understand that, but I would like that the user will be deleted from the webmail database too.

Can anyone knows how can I do this?

Thanks,

Diego

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,850
delete user in the roundcube table after delete from postfixadmin
« Reply #1 on: August 12, 2011, 05:25:47 AM »
one way would be to run a cron job every night and delete anything in the rc users table which doesnt exist in the postfix one. as long as the rc tables are linked properly the delete will cascade and delete all the user's stuff from the other tables automatically.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline dimago

  • Jr. Member
  • **
  • Posts: 33
delete user in the roundcube table after delete from postfixadmin
« Reply #2 on: August 12, 2011, 05:28:40 PM »
Hi John,

Thanks again for you help.

So, let me see if I understood.

OK, I know what users I want to delete.

I make a script to delete the user diego in the USERS RC tables, like this: delete from USERS where USERNAME='diego'; ?

So, the rest of info about the user, in anothers RC tables will be deleted automatically?

Thanks,

Diego
« Last Edit: August 12, 2011, 05:39:45 PM by dimago »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,850
delete user in the roundcube table after delete from postfixadmin
« Reply #3 on: August 13, 2011, 04:12:38 AM »
thats the idea, though I think it might depend on your particular implementation. take a look at the rc sql file mysql.initial.sql in trunk/roundcubemail/SQL see all the "ON DELETE CASCADE" bits? thats what does it.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline oldschool

  • Sr. Member
  • ****
  • Posts: 406
delete user in the roundcube table after delete from postfixadmin
« Reply #4 on: August 13, 2011, 12:04:38 PM »
Nice thread!

The ideas and infos help a lot...



Rgds.

Offline dimago

  • Jr. Member
  • **
  • Posts: 33
delete user in the roundcube table after delete from postfixadmin
« Reply #5 on: August 13, 2011, 04:00:58 PM »
hey John,

Here my feedback.

It´s works.

I did:

delete from users where username='diego@email.com';

and all of infos in the tables are deleted.

I will make a script to do this auto to me.

Thanks again.

Diego