.setAdditionalFields(newArrayList("metrics", "periods")));
assertThat(response).isNotNull();
+ assertThat(response.getBaseComponent().getKey()).isEqualTo("sample");
assertThat(response.getMetrics().getMetricsList()).extracting("key").containsOnly("ncloc");
List<WsMeasures.Component> components = response.getComponentsList();
assertThat(components).hasSize(2).extracting("key").containsOnly("sample:src/main/xoo/sample", FILE_KEY);
- assertThat(components.get(0).getMeasuresList().get(0).getValue()).isEqualTo("13");
+ assertThat(components.get(0).getMeasures().getMeasuresList().get(0).getValue()).isEqualTo("13");
}
}
private void checkPermissions(ComponentDto baseComponent) {
String projectUuid = firstNonNull(baseComponent.projectUuid(), baseComponent.uuid());
- if (!userSession.hasGlobalPermission(GlobalPermissions.SYSTEM_ADMIN) &&
- !userSession.hasProjectPermissionByUuid(UserRole.ADMIN, projectUuid) &&
- !userSession.hasProjectPermissionByUuid(UserRole.USER, projectUuid)) {
+ if (!userSession.hasPermission(GlobalPermissions.SYSTEM_ADMIN) &&
+ !userSession.hasComponentUuidPermission(UserRole.ADMIN, projectUuid) &&
+ !userSession.hasComponentUuidPermission(UserRole.USER, projectUuid)) {
throw insufficientPrivilegesException();
}
}