Skip to content

Commit

Permalink
fix(roles/file): Handle empty file-based roles. (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
stewchen authored May 14, 2018
1 parent 6b05e17 commit c480983
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,12 @@ static class UserRoles {
List<Role> roles;

public List<Role> 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());
}
}
}
4 changes: 4 additions & 0 deletions fiat-file/src/test/resources/fiat-test-permissions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ users:
roles:
- crimeFighter
- jokerJailer
- username: robin
roles: []
- username: nanana

0 comments on commit c480983

Please sign in to comment.