Cache the user's groups so that permission checks don't result in multiple db calls

Reference #191