Reduce queries

This commit lowers the amount of queries on the login page from 104 to 3
(with all base Fork modules installed).

For not loggedin users, it tried to fetch the allowed modules every
time an isAllowedAction or isAllowedModule was executed. This cached variable stayed
empty, so the same database call was done over and over again.

This PR makes sure we can't get heavy load on the backend from unauthenticated users.