diff --git a/fiat-file/src/main/java/com/netflix/spinnaker/fiat/roles/file/FileBasedUserRolesProvider.java b/fiat-file/src/main/java/com/netflix/spinnaker/fiat/roles/file/FileBasedUserRolesProvider.java index a30fbb34e..8361a546c 100644 --- a/fiat-file/src/main/java/com/netflix/spinnaker/fiat/roles/file/FileBasedUserRolesProvider.java +++ b/fiat-file/src/main/java/com/netflix/spinnaker/fiat/roles/file/FileBasedUserRolesProvider.java @@ -102,9 +102,12 @@ static class UserRoles { List roles; public List getRoles() { + if (roles == null) { + return Collections.emptyList(); + } return roles.stream() - .map(r -> new Role(r.getName()).setSource(Role.Source.FILE)) - .collect(Collectors.toList()); + .map(r -> new Role(r.getName()).setSource(Role.Source.FILE)) + .collect(Collectors.toList()); } } } diff --git a/fiat-file/src/test/resources/fiat-test-permissions.yml b/fiat-file/src/test/resources/fiat-test-permissions.yml index 87a0337c6..bf3b9bbf1 100644 --- a/fiat-file/src/test/resources/fiat-test-permissions.yml +++ b/fiat-file/src/test/resources/fiat-test-permissions.yml @@ -7,3 +7,7 @@ users: roles: - crimeFighter - jokerJailer + - username: robin + roles: [] + - username: nanana +