Adding PermissionLoader tests and fixing repository method for loading permissions