diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 12:09:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 12:09:42 +0000 |
commit | 729e3765d5feb762df1ccfbc228a8dd4662aa3f9 (patch) | |
tree | f326420fc64999c6bcc28816ed54f0972fb46459 /app/policies | |
parent | 6f7881ee9dcec34141a8f34fc814b56b366d2b48 (diff) | |
download | gitlab-ce-729e3765d5feb762df1ccfbc228a8dd4662aa3f9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/release_policy.rb | 27 | ||||
-rw-r--r-- | app/policies/releases/evidence_policy.rb | 34 |
2 files changed, 34 insertions, 27 deletions
diff --git a/app/policies/release_policy.rb b/app/policies/release_policy.rb index 0fd1312c511..d7f9e5d7445 100644 --- a/app/policies/release_policy.rb +++ b/app/policies/release_policy.rb @@ -2,31 +2,4 @@ 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 diff --git a/app/policies/releases/evidence_policy.rb b/app/policies/releases/evidence_policy.rb new file mode 100644 index 00000000000..701913e6fe4 --- /dev/null +++ b/app/policies/releases/evidence_policy.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Releases + class EvidencePolicy < BasePolicy + delegate { @subject.release.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 +end |