summaryrefslogtreecommitdiff
path: root/lib/gitlab/git_access_snippet.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/git_access_snippet.rb')
-rw-r--r--lib/gitlab/git_access_snippet.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/gitlab/git_access_snippet.rb b/lib/gitlab/git_access_snippet.rb
index e11c1ea527c..d05ffe9b508 100644
--- a/lib/gitlab/git_access_snippet.rb
+++ b/lib/gitlab/git_access_snippet.rb
@@ -14,6 +14,8 @@ module Gitlab
attr_reader :snippet
+ alias_method :container, :snippet
+
def initialize(actor, snippet, protocol, **kwargs)
@snippet = snippet
@@ -53,11 +55,6 @@ module Gitlab
check_change_access!
end
- override :repository
- def repository
- snippet&.repository
- end
-
def check_snippet_accessibility!
if snippet.blank?
raise NotFoundError, ERROR_MESSAGES[:snippet_not_found]
@@ -89,11 +86,15 @@ module Gitlab
raise ForbiddenError, ERROR_MESSAGES[:update_snippet]
end
+ check_size_before_push!
+
changes_list.each do |change|
# If user does not have access to make at least one change, cancel all
# push by allowing the exception to bubble up
check_single_change_access(change)
end
+
+ check_push_size!
end
def check_single_change_access(change)