I am looking for an automated way to delete the new, bogus, totally
unused (and unusable) user accounts created by user registration bots
that have been plaguing two of our repositories. Doing it manually in
the admin interface is just too tedious when there are several new ones
every day.
If you wanted to write a tool to do this, how would you go about it?
I want to be able to delete the user with username "foo" simply, like
this for example:
$ java -jar rmuser.jar org.flo.rmuser foo
Or I would be happy (happier!!) to do it all in SQL, if that's not
playing with fire. I just did this in our "sandbox" repository and it
seemed to do the trick:
DELETE FROM ir_user.user_department WHERE user_id = xxx;
DELETE FROM ir_user.user_role WHERE user_id = xxx;
UPDATE ir_user.ir_user SET default_email_id = NULL
WHERE user_id = xxx;
DELETE FROM ir_user.user_email WHERE user_id = xxx;
DELETE FROM ir_user.ir_user WHERE user_id = xxx;
(The UPDATE appears to be needed due to a cycle in the foreign key
constraints, though I'm not SQL-savvy enough to be sure of this.)
I'm a Unix/Linux snob who doesn't want to have to write a Java program
to do this but I will bite the bullet and write one if necessary and if
it's not too complicated. In other words, if it requires an IDE and a
dozen files (Java, XML, etc.) then I won't do it; but if I can use javac
and one file of Java code, then I'm game.
I'm guessing that I would import edu.ur.ir.user.UserService and call its
deleteUser method, but I don't know The Java Way well enough to know
what all else I would have to do.
Am I crazy? Am I dreaming?
Thanks in advance,
Paul.
--
Paul Hoffman <
pa...@flo.org>
Systems Librarian
Fenway Libraries Online
c/o Wentworth Institute of Technology
550 Huntington Ave.
Boston, MA 02115
(617) 442-2384 (FLO main number)