diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-09-30 16:49:55 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-09-30 16:49:55 +0300 |
commit | 715eaed6aecc77512d5c3f99c9cb26c143380fdd (patch) | |
tree | ff7fd458f290a39a73a48cde1612b179efae4973 /lib/api/project_hooks.rb | |
parent | 73f780d640e442c9b2d9eb4fc7297f91c6cc76ee (diff) | |
download | gitlab-ce-715eaed6aecc77512d5c3f99c9cb26c143380fdd.tar.gz |
Refactor API: project hooks
Diffstat (limited to 'lib/api/project_hooks.rb')
-rw-r--r-- | lib/api/project_hooks.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/api/project_hooks.rb b/lib/api/project_hooks.rb index 28501256795..738974955f3 100644 --- a/lib/api/project_hooks.rb +++ b/lib/api/project_hooks.rb @@ -2,6 +2,7 @@ module API # Projects API class ProjectHooks < Grape::API before { authenticate! } + before { authorize_admin_project } resource :projects do helpers do @@ -20,7 +21,6 @@ module API # Example Request: # GET /projects/:id/hooks get ":id/hooks" do - authorize! :admin_project, user_project @hooks = paginate user_project.hooks present @hooks, with: Entities::Hook end @@ -33,7 +33,6 @@ module API # Example Request: # GET /projects/:id/hooks/:hook_id get ":id/hooks/:hook_id" do - authorize! :admin_project, user_project @hook = user_project.hooks.find(params[:hook_id]) present @hook, with: Entities::Hook end @@ -47,7 +46,6 @@ module API # Example Request: # POST /projects/:id/hooks post ":id/hooks" do - authorize! :admin_project, user_project required_attributes! [:url] @hook = user_project.hooks.new({"url" => params[:url]}) @@ -71,7 +69,6 @@ module API # PUT /projects/:id/hooks/:hook_id put ":id/hooks/:hook_id" do @hook = user_project.hooks.find(params[:hook_id]) - authorize! :admin_project, user_project required_attributes! [:url] attrs = attributes_for_keys [:url] @@ -93,7 +90,6 @@ module API # Example Request: # DELETE /projects/:id/hooks/:hook_id delete ":id/hooks/:hook_id" do - authorize! :admin_project, user_project required_attributes! [:hook_id] begin |