Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-13 12:08:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-13 12:08:27 +0300
commit15ae4a8da83661f2b714d804721001a53b354d28 (patch)
tree91080b2b969a66857d78fb9008c1d0c367132a8d /app/policies/ci
parent8f71e69fdbb65d2cf95cf16ef5a0add0919edb45 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies/ci')
-rw-r--r--app/policies/ci/bridge_policy.rb12
-rw-r--r--app/policies/ci/build_policy.rb2
2 files changed, 14 insertions, 0 deletions
diff --git a/app/policies/ci/bridge_policy.rb b/app/policies/ci/bridge_policy.rb
new file mode 100644
index 00000000000..37a07ea8aaf
--- /dev/null
+++ b/app/policies/ci/bridge_policy.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+module Ci
+ class BridgePolicy < CommitStatusPolicy
+ condition(:can_update_downstream_branch) do
+ ::Gitlab::UserAccess.new(@user, container: @subject.downstream_project)
+ .can_update_branch?(@subject.target_revision_ref)
+ end
+
+ rule { can_update_downstream_branch }.enable :play_job
+ end
+end
diff --git a/app/policies/ci/build_policy.rb b/app/policies/ci/build_policy.rb
index b3950c6a0e3..3efc07421e4 100644
--- a/app/policies/ci/build_policy.rb
+++ b/app/policies/ci/build_policy.rb
@@ -60,6 +60,8 @@ module Ci
rule { can?(:update_build) & terminal }.enable :create_build_terminal
+ rule { can?(:update_build) }.enable :play_job
+
rule { is_web_ide_terminal & can?(:create_web_ide_terminal) & (admin | owner_of_job) }.policy do
enable :read_web_ide_terminal
enable :update_web_ide_terminal