DB security cleanup

Just a bit of cleanup prior to the main work on https://bugs.launchpad.net/openquake/+bug/1117052.