diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-12 15:45:46 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-12 15:55:12 +0200 |
commit | 69c04498ef0a49186a667fd44383b9b43690a91e (patch) | |
tree | e258463d00c42f296d4048f44b8743eb98161567 /lib/api/commit_statuses.rb | |
parent | 0aefeeb882b40d740b80f15ac6610a88a340d30b (diff) | |
download | gitlab-ce-69c04498ef0a49186a667fd44383b9b43690a91e.tar.gz |
Small bug fixes
Diffstat (limited to 'lib/api/commit_statuses.rb')
-rw-r--r-- | lib/api/commit_statuses.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/api/commit_statuses.rb b/lib/api/commit_statuses.rb index ca750320e40..2a005d6a9f7 100644 --- a/lib/api/commit_statuses.rb +++ b/lib/api/commit_statuses.rb @@ -5,7 +5,6 @@ module API class CommitStatus < Grape::API resource :projects do before { authenticate! } - before { authorize! :read_commit_statuses, user_project } # Get a commit's statuses # @@ -19,13 +18,14 @@ module API # Examples: # GET /projects/:id/repository/commits/:sha/statuses get ':id/repository/commits/:sha/statuses' do + authorize! :read_commit_statuses, user_project sha = params[:sha] ci_commit = user_project.ci_commit(sha) not_found! 'Commit' unless ci_commit statuses = ci_commit.statuses statuses = statuses.latest unless parse_boolean(params[:all]) statuses = statuses.where(ref: params[:ref]) if params[:ref].present? - statuses = statuses.where(name: params[:stage]) if params[:stage].present? + statuses = statuses.where(stage: params[:stage]) if params[:stage].present? statuses = statuses.where(name: params[:name]) if params[:name].present? present paginate(statuses), with: Entities::CommitStatus end @@ -43,6 +43,7 @@ module API # Examples: # POST /projects/:id/statuses/:sha post ':id/statuses/:sha' do + authorize! :create_commit_statuses, user_project required_attributes! [:state] attrs = attributes_for_keys [:ref, :target_url, :description, :context, :name] commit = @project.commit(params[:sha]) |