diff options
author | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-11-26 20:02:36 +0300 |
---|---|---|
committer | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-11-26 20:02:36 +0300 |
commit | 0844bbf60cf9aaada64e392664b4047c54d1e6b6 (patch) | |
tree | b175846a466d95251553be4f508af88eb32e586d /lib/gitlab | |
parent | 402c75004b9fafc14cc563dd25ce9719b3882c54 (diff) | |
parent | a416b83b6c0e1b8db9dd9829d16ca420bdb2fbe9 (diff) |
Merge branch 'security-ag-cycle-analytics-guest-permissions' into 'master'
Prevent guests from seeing commits for cycle analytics
See merge request gitlab/gitlabhq!3519
Diffstat (limited to 'lib/gitlab')
-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 |