Author Topic: bin/deluser.sh help  (Read 3481 times)

Offline ramgs

  • Jr. Member
  • **
  • Posts: 21
bin/deluser.sh help
« on: January 09, 2016, 09:16:57 PM »
Hello.

Can the bin/deluser.sh script be used to remove entries in the Roundcube database based on user_id or email_address? Or is the argument to this command limited to the username alone?

I found recently that old user entries from a test version are still hanging around. I thought I had removed them, but actually had not. In the live system, the IP address and hostname changed, so the test users got a new user_id. How may I cleanly remove the old entries?

Thanks.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: bin/deluser.sh help
« Reply #1 on: January 09, 2016, 09:25:28 PM »
Code: [Select]
Usage: deluser.sh [--host=mail_host] username
 --host=HOST  The IMAP hostname or IP the given user is related to

Offline ramgs

  • Jr. Member
  • **
  • Posts: 21
Re: bin/deluser.sh help
« Reply #2 on: January 09, 2016, 10:00:45 PM »
Thanks for your reply, SKaero.

I've used deluser.sh before in its simplest form, so I'm aware that the syntax says 'username'. Are you suggesting that I try the host option, since that had changed between the test and live system in my case?

General Qs:

This is the searching line in the php script (I know some php but not enough to deal with databases)
// find user in loca database
$user = rcube_user::query($username, $args['host']);

The "rcube_user" must mean username, but I was wondering if it picks anything that might be a part of that particular entry.

At the end, this script finds the user_id associated with username. It might be convenient to allow deletion based on user_id, since it is unique across the database, even if the username is repeated for some reason. It seems this would be a small change in this deluser.sh script.

Thanks.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: bin/deluser.sh help
« Reply #3 on: January 10, 2016, 05:56:00 PM »
I was suggesting using the host option since that is an identifier for the user that your trying to delete.

"rcube_user" is referring the rcube_user class which can be found in <RC root>/program/lib/Roundcube/rcube_user.php the query function only looks at the username and host fields.

I don't think its a bad idea to be able to delete based on user id, I can defiantly see use cases for it, you could create a feature request for it on the bug tracker: http://trac.roundcube.net/

Offline ramgs

  • Jr. Member
  • **
  • Posts: 21
Re: bin/deluser.sh help
« Reply #4 on: January 11, 2016, 03:13:36 AM »
Thank you! It worked like a charm.