|
@@ -36,7 +36,7 @@ public class AccessController implements AuthorizationApi {
|
|
.map(user -> accessControlService.getRoles()
|
|
.map(user -> accessControlService.getRoles()
|
|
.stream()
|
|
.stream()
|
|
.filter(role -> user.groups().contains(role.getName()))
|
|
.filter(role -> user.groups().contains(role.getName()))
|
|
- .map(role -> mapPermissions(role.getPermissions(), role.getClusters()))
|
|
|
|
|
|
+ .map(role -> mapPermissions(role.getName(), role.getPermissions(), role.getClusters()))
|
|
.flatMap(Collection::stream)
|
|
.flatMap(Collection::stream)
|
|
.collect(Collectors.toList())
|
|
.collect(Collectors.toList())
|
|
)
|
|
)
|
|
@@ -57,11 +57,12 @@ public class AccessController implements AuthorizationApi {
|
|
.map(ResponseEntity::ok);
|
|
.map(ResponseEntity::ok);
|
|
}
|
|
}
|
|
|
|
|
|
- private List<UserPermissionDTO> mapPermissions(List<Permission> permissions, List<String> clusters) {
|
|
|
|
|
|
+ private List<UserPermissionDTO> mapPermissions(String name, List<Permission> permissions, List<String> clusters) {
|
|
return permissions
|
|
return permissions
|
|
.stream()
|
|
.stream()
|
|
.map(permission -> {
|
|
.map(permission -> {
|
|
UserPermissionDTO dto = new UserPermissionDTO();
|
|
UserPermissionDTO dto = new UserPermissionDTO();
|
|
|
|
+ dto.setRoleName(name);
|
|
dto.setClusters(clusters);
|
|
dto.setClusters(clusters);
|
|
dto.setResource(ResourceTypeDTO.fromValue(permission.getResource().toString().toUpperCase()));
|
|
dto.setResource(ResourceTypeDTO.fromValue(permission.getResource().toString().toUpperCase()));
|
|
dto.setValue(permission.getValue());
|
|
dto.setValue(permission.getValue());
|