Fixed a bug when a list of classes was empty.

This would happen when checking the permissions of a user that was not assicated with any classes in a given scenario.

Closes #505