summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2018-04-12 17:04:08 +0000
committerRobert Speicher <robert@gitlab.com>2018-04-12 17:04:08 +0000
commitf5a3d8f75de50f0ac6a14e77c672da79df85866e (patch)
treeb0d3655e4a738867696e82cee07309b17e175531 /lib
parent64f91be000bc2963a48851db4dcb0a6bbd2b57bc (diff)
parenteae2ed3366ac13832c56aefe965513b986d7e8b1 (diff)
downloadgitlab-ce-f5a3d8f75de50f0ac6a14e77c672da79df85866e.tar.gz
Merge branch 'dm-archived-read-only' into 'master'
Make archived projects completely read-only Closes #44788 See merge request gitlab-org/gitlab-ce!18136
Diffstat (limited to 'lib')
-rw-r--r--lib/api/merge_requests.rb2
-rw-r--r--lib/api/v3/merge_requests.rb2
-rw-r--r--lib/gitlab/email/handler/create_merge_request_handler.rb3
-rw-r--r--lib/gitlab/user_access.rb2
4 files changed, 5 insertions, 4 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index 3264a26f7d2..d4cc18f622b 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -189,7 +189,7 @@ module API
post ":id/merge_requests" do
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42316')
- authorize! :create_merge_request, user_project
+ authorize! :create_merge_request_from, user_project
mr_params = declared_params(include_missing: false)
mr_params[:force_remove_source_branch] = mr_params.delete(:remove_source_branch)
diff --git a/lib/api/v3/merge_requests.rb b/lib/api/v3/merge_requests.rb
index ce216497996..9b0f70e2bfe 100644
--- a/lib/api/v3/merge_requests.rb
+++ b/lib/api/v3/merge_requests.rb
@@ -93,7 +93,7 @@ module API
post ":id/merge_requests" do
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42126')
- authorize! :create_merge_request, user_project
+ authorize! :create_merge_request_from, user_project
mr_params = declared_params(include_missing: false)
mr_params[:force_remove_source_branch] = mr_params.delete(:remove_source_branch) if mr_params[:remove_source_branch].present?
diff --git a/lib/gitlab/email/handler/create_merge_request_handler.rb b/lib/gitlab/email/handler/create_merge_request_handler.rb
index 3436306e122..2f864f2082b 100644
--- a/lib/gitlab/email/handler/create_merge_request_handler.rb
+++ b/lib/gitlab/email/handler/create_merge_request_handler.rb
@@ -23,7 +23,8 @@ module Gitlab
def execute
raise ProjectNotFound unless project
- validate_permission!(:create_merge_request)
+ validate_permission!(:create_merge_request_in)
+ validate_permission!(:create_merge_request_from)
verify_record!(
record: create_merge_request,
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb
index 24393f96d96..69952cbb47c 100644
--- a/lib/gitlab/user_access.rb
+++ b/lib/gitlab/user_access.rb
@@ -51,7 +51,7 @@ module Gitlab
return false unless can_access_git?
if protected?(ProtectedBranch, project, ref)
- user.can?(:delete_protected_branch, project)
+ user.can?(:push_to_delete_protected_branch, project)
else
user.can?(:push_code, project)
end