diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/snippets.rb | 14 | ||||
-rw-r--r-- | lib/gitlab/usage_data.rb | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/api/snippets.rb b/lib/api/snippets.rb index c6ef35875fc..3acf8b2e944 100644 --- a/lib/api/snippets.rb +++ b/lib/api/snippets.rb @@ -5,8 +5,6 @@ module API class Snippets < Grape::API::Instance include PaginationParams - before { authenticate! } - resource :snippets do helpers Helpers::SnippetsHelpers helpers do @@ -23,7 +21,7 @@ module API end end - desc 'Get a snippets list for authenticated user' do + desc 'Get a snippets list for an authenticated user' do detail 'This feature was introduced in GitLab 8.15.' success Entities::Snippet end @@ -31,6 +29,8 @@ module API use :pagination end get do + authenticate! + present paginate(snippets_for_current_user), with: Entities::Snippet, current_user: current_user end @@ -42,6 +42,8 @@ module API use :pagination end get 'public' do + authenticate! + present paginate(public_snippets), with: Entities::PersonalSnippet, current_user: current_user end @@ -74,6 +76,8 @@ module API use :create_file_params end post do + authenticate! + authorize! :create_snippet attrs = process_create_params(declared_params(include_missing: false)) @@ -109,6 +113,8 @@ module API use :minimum_update_params end put ':id' do + authenticate! + snippet = snippets_for_current_user.find_by_id(params.delete(:id)) break not_found!('Snippet') unless snippet @@ -139,6 +145,8 @@ module API requires :id, type: Integer, desc: 'The ID of a snippet' end delete ':id' do + authenticate! + snippet = snippets_for_current_user.find_by_id(params.delete(:id)) break not_found!('Snippet') unless snippet diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index fbfc7beed9a..b9b9164d746 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -816,8 +816,6 @@ module Gitlab clear_memoization(:unique_visit_service) clear_memoization(:deployment_minimum_id) clear_memoization(:deployment_maximum_id) - clear_memoization(:approval_merge_request_rule_minimum_id) - clear_memoization(:approval_merge_request_rule_maximum_id) clear_memoization(:project_minimum_id) clear_memoization(:project_maximum_id) clear_memoization(:auth_providers) |