From d674690602da5b1e6cacf1ab002315213477ae0c Mon Sep 17 00:00:00 2001 From: C4tWithShell Date: Wed, 25 Oct 2023 23:31:14 +0300 Subject: [PATCH] Fix ListAction --- .../pullrequest/ws/pullrequest/action/ListAction.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/github/mc1arke/sonarqube/plugin/server/pullrequest/ws/pullrequest/action/ListAction.java b/src/main/java/com/github/mc1arke/sonarqube/plugin/server/pullrequest/ws/pullrequest/action/ListAction.java index ca36a46..9530955 100644 --- a/src/main/java/com/github/mc1arke/sonarqube/plugin/server/pullrequest/ws/pullrequest/action/ListAction.java +++ b/src/main/java/com/github/mc1arke/sonarqube/plugin/server/pullrequest/ws/pullrequest/action/ListAction.java @@ -90,13 +90,13 @@ public void handleProjectRequest(ProjectDto project, Request request, Response r .map(BranchDto::getMergeBranchUuid) .filter(Objects::nonNull) .collect(Collectors.toList())) - .stream().collect(MoreCollectors.uniqueIndex(BranchDto::getUuid)); + .stream().collect(CommunityMoreCollectors.uniqueIndex(BranchDto::getUuid)); Map qualityGateMeasuresByComponentUuids = getDbClient().liveMeasureDao() .selectByComponentUuidsAndMetricKeys(dbSession, pullRequestUuids, List.of(CoreMetrics.ALERT_STATUS_KEY)).stream() - .collect(MoreCollectors.uniqueIndex(LiveMeasureDto::getComponentUuid)); + .collect(CommunityMoreCollectors.uniqueIndex(LiveMeasureDto::getComponentUuid)); Map analysisDateByBranchUuid = getDbClient().snapshotDao().selectLastAnalysesByRootComponentUuids(dbSession, pullRequestUuids).stream() - .collect(MoreCollectors.uniqueIndex(SnapshotDto::getComponentUuid, s -> DateUtils.formatDateTime(s.getCreatedAt()))); + .collect(CommunityMoreCollectors.uniqueIndex(SnapshotDto::getComponentUuid, s -> DateUtils.formatDateTime(s.getCreatedAt()))); ProjectPullRequests.ListWsResponse.Builder protobufResponse = ProjectPullRequests.ListWsResponse.newBuilder(); pullRequests @@ -106,8 +106,8 @@ public void handleProjectRequest(ProjectDto project, Request request, Response r } private static void checkPermission(ProjectDto project, UserSession userSession) { - if (userSession.hasProjectPermission(UserRole.USER, project) || - userSession.hasProjectPermission(UserRole.SCAN, project) || + if (userSession.hasEntityPermission(UserRole.USER, project) || + userSession.hasEntityPermission(UserRole.SCAN, project) || userSession.hasPermission(GlobalPermission.SCAN)) { return; }