use of org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse in project sonarqube by SonarSource.
the class SearchProjectPermissionsAction method buildResponse.
private SearchProjectPermissionsWsResponse buildResponse(SearchProjectPermissionsData data) {
SearchProjectPermissionsWsResponse.Builder response = SearchProjectPermissionsWsResponse.newBuilder();
Permission.Builder permissionResponse = Permission.newBuilder();
Project.Builder rootComponentBuilder = Project.newBuilder();
for (ComponentDto rootComponent : data.rootComponents()) {
rootComponentBuilder.clear().setId(rootComponent.uuid()).setKey(rootComponent.key()).setQualifier(rootComponent.qualifier()).setName(rootComponent.name());
for (String permission : data.permissions(rootComponent.getId())) {
rootComponentBuilder.addPermissions(permissionResponse.clear().setKey(permission).setUsersCount(data.userCount(rootComponent.getId(), permission)).setGroupsCount(data.groupCount(rootComponent.getId(), permission)));
}
response.addProjects(rootComponentBuilder);
}
for (String permissionKey : ProjectPermissions.ALL) {
response.addPermissions(permissionResponse.clear().setKey(permissionKey).setName(i18nName(permissionKey)).setDescription(i18nDescriptionMessage(permissionKey)));
}
Paging paging = data.paging();
response.setPaging(Common.Paging.newBuilder().setPageIndex(paging.pageIndex()).setPageSize(paging.pageSize()).setTotal(paging.total()));
return response.build();
}
use of org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse in project sonarqube by SonarSource.
the class SearchProjectPermissionsAction method handle.
@Override
public void handle(Request wsRequest, Response wsResponse) throws Exception {
SearchProjectPermissionsWsResponse searchProjectPermissionsWsResponse = doHandle(toSearchProjectPermissionsWsRequest(wsRequest));
writeProtobuf(searchProjectPermissionsWsResponse, wsRequest, wsResponse);
}
Aggregations