Add support for temporary admins, and clean up some similar code elsewhere.