summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-06 12:47:52 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-04-11 10:51:14 +0200
commitec43e3644436e0ae90f6fb6a64256c38ceb68cc9 (patch)
treeae0ad64114b9708cd04c43a3f398e9983aa62119 /app/policies
parent267dba0ae56c6236b49907ad77fd572578c7b30e (diff)
downloadgitlab-ce-ec43e3644436e0ae90f6fb6a64256c38ceb68cc9.tar.gz
Prevent new merge requests for archived projects
This prevents creating merge requests targeting archived projects. This could happen when a project was already forked, but then the source was archived.
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/project_policy.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb
index b4970b605ca..72e30c932a9 100644
--- a/app/policies/project_policy.rb
+++ b/app/policies/project_policy.rb
@@ -140,6 +140,7 @@ class ProjectPolicy < BasePolicy
rule { can?(:guest_access) }.policy do
enable :read_project
+ enable :create_merge_request_in_project
enable :read_board
enable :read_list
enable :read_wiki
@@ -250,6 +251,7 @@ class ProjectPolicy < BasePolicy
prevent :request_access
prevent :upload_file
prevent :resolve_note
+ prevent :create_merge_request_in_project
READONLY_FEATURES_WHEN_ARCHIVED.each do |feature|
prevent(*create_update_admin_destroy(feature))
@@ -261,6 +263,7 @@ class ProjectPolicy < BasePolicy
end
rule { merge_requests_disabled | repository_disabled }.policy do
+ prevent :create_merge_request_in_project
prevent(*create_read_update_admin_destroy(:merge_request))
end
@@ -306,6 +309,7 @@ class ProjectPolicy < BasePolicy
rule { can?(:public_access) }.policy do
enable :read_project
+ enable :create_merge_request_in_project
enable :read_board
enable :read_list
enable :read_wiki