diff options
author | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-11-26 15:02:08 +0300 |
---|---|---|
committer | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-11-26 15:02:08 +0300 |
commit | ccb32647be0f8cb9f10377e230457cbf6dec3408 (patch) | |
tree | 13d37ccb412caa55ab77570161f275e3b9e274e5 /lib | |
parent | 83e8f432e03fee659c3ac0bd718f40dff0bf8e45 (diff) | |
parent | b3076997eb00021004063cf552fb07bbd117e81a (diff) |
Merge branch 'security-ag-cycle-analytics-guest-permissions-12-5' into '12-5-stable'
Prevent guests from seeing commits for cycle analytics
See merge request gitlab/gitlabhq!3534
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/cycle_analytics/stage_summary.rb | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/gitlab/cycle_analytics/stage_summary.rb b/lib/gitlab/cycle_analytics/stage_summary.rb index ea440c441b7..9c75d4bb455 100644 --- a/lib/gitlab/cycle_analytics/stage_summary.rb +++ b/lib/gitlab/cycle_analytics/stage_summary.rb @@ -11,13 +11,29 @@ module Gitlab end def data - [serialize(Summary::Issue.new(project: @project, from: @from, to: @to, current_user: @current_user)), - serialize(Summary::Commit.new(project: @project, from: @from, to: @to)), - serialize(Summary::Deploy.new(project: @project, from: @from, to: @to))] + summary = [issue_stats] + summary << commit_stats if user_has_sufficient_access? + summary << deploy_stats end private + def issue_stats + serialize(Summary::Issue.new(project: @project, from: @from, to: @to, current_user: @current_user)) + end + + def commit_stats + serialize(Summary::Commit.new(project: @project, from: @from, to: @to)) + end + + def deploy_stats + serialize(Summary::Deploy.new(project: @project, from: @from, to: @to)) + end + + def user_has_sufficient_access? + @project.team.member?(@current_user, Gitlab::Access::REPORTER) + end + def serialize(summary_object) AnalyticsSummarySerializer.new.represent(summary_object) end |