Use fetchAll in the permissions cache

For #7657 

Improves the performance of the permissions cache.

cc @DeepDiver1975 @PVince81 @BrentNewland