Reduce number of DB queries when checking access.