Fix for recusive db hit when get_users_with_perms with
attach_perms=True.