summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-02 21:07:38 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-02 21:07:38 +0000
commit9d54184f308893338967b18874dedebf38acf89e (patch)
tree100e32c6d4b34deac52d9e98a083361d89804b50 /app/policies
parentd5b5f5e6e1474d5526add9033c9754b8e395841f (diff)
downloadgitlab-ce-9d54184f308893338967b18874dedebf38acf89e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/release_policy.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/policies/release_policy.rb b/app/policies/release_policy.rb
index d7f9e5d7445..0fd1312c511 100644
--- a/app/policies/release_policy.rb
+++ b/app/policies/release_policy.rb
@@ -2,4 +2,31 @@
class ReleasePolicy < BasePolicy
delegate { @subject.project }
+
+ rule { allowed_to_read_evidence & external_authorization_service_disabled }.policy do
+ enable :read_release_evidence
+ end
+
+ ##
+ # evidence.summary includes the following entities:
+ # - Release
+ # - git-tag (Repository)
+ # - Project
+ # - Milestones
+ # - Issues
+ condition(:allowed_to_read_evidence) do
+ can?(:read_release) &&
+ can?(:download_code) &&
+ can?(:read_project) &&
+ can?(:read_milestone) &&
+ can?(:read_issue)
+ end
+
+ ##
+ # Currently, we don't support release evidence for the GitLab instances
+ # that enables external authorization services.
+ # See https://gitlab.com/gitlab-org/gitlab/issues/121930.
+ condition(:external_authorization_service_disabled) do
+ !Gitlab::ExternalAuthorization::Config.enabled?
+ end
end