Thursday, May 30, 2013

Request Tracker: how to delete stuff (tickets, users, etc.)

Before I learned more about Request Tracker's ACL system and the DeleteTicket right, I noticed that Request Tracker's web UI didn't seem to offer any options for deleting stuff. There was no way to issue a "delete ticket" or "delete user" command. Or was there?

Of course, now I know that if I log in as 'root' or have 'DeleteTicket' and other administrator-level rights, there _is_ a "delete ticket" option in the Request Tracker web UI.

Users are typically not deleted, but rather disabled. This is done by disabling the option in the user's settings where it says "Let this user access RT".

Now, the old blog entry was about the Shredder, which is a tool for wiping out Request Tracker objects by deleting them, along with all their associated baggage, from the underlying database. Since the RT database is quite complex, making any changes to it is fraught with danger. The Shredder provides a safe way to not just delete, but completely eradicate (wipe out) objects. Be careful when using it.

In later versions of RT (4.0.13, 4.0.17, etc.), the Shredder is available (to the 'root' RT user) through the web UI. The rest of this old blog entry is about accessing the Shredder from the command line.

On my openSUSE 12.3 system with Request Tracker 4.0.13 installed and running, I can do:
# cd /usr/sbin
# ls rt-*
rt-attributes-viewer  rt-email-group-admin   rt-setup-database
rt-clean-mason-cache  rt-fulltext-indexer    rt-setup-fulltext-index
rt-clean-sessions     rt-preferences-viewer  rt-shredder
rt-dump-metadata      rt-server              rt-test-dependencies
rt-email-dashboards   rt-server.fcgi         rt-validate-aliases
rt-email-digest       rt-session-viewer      rt-validator

Hmm, interesting. Now, let me look at rt-shredder. One way would be to simply run less on that file. However, since the documentation for the script is included in the same file as the script, I can do this:
# perldoc rt-shredder

Although the summary says it's a "script which wipe out tickets from RT DB", it can wipe out more than just tickets:
# rt-shredder --plugin list
Plugins list:
# rt-shredder --plugin help-Users
# rt-shredder --plugin help-Tickets

No comments:

Post a Comment