summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-26 15:55:56 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-26 15:55:56 +0200
commit342d5537091e61c1fc52f3e54df926159f326eb8 (patch)
tree6e852b3f112a6a9f03d05148ed5e73e13582a48e /lib/api
parentd5947ada4493335d49368ec193f4b9b801582deb (diff)
downloadgitlab-ce-342d5537091e61c1fc52f3e54df926159f326eb8.tar.gz
Rename abilities to correspond contoller/model action namesrename-abilities
write_ was renamed to create_ modify_ was renamed to update_ So now in update action we have next code def create can?(current_user, :create_issue, @issue) end def update can?(current_user, :update_issue, @issue) end Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/issues.rb2
-rw-r--r--lib/api/merge_requests.rb4
-rw-r--r--lib/api/project_snippets.rb6
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb
index c8db93eb778..ca16d254f14 100644
--- a/lib/api/issues.rb
+++ b/lib/api/issues.rb
@@ -144,7 +144,7 @@ module API
# PUT /projects/:id/issues/:issue_id
put ":id/issues/:issue_id" do
issue = user_project.issues.find(params[:issue_id])
- authorize! :modify_issue, issue
+ authorize! :update_issue, issue
attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id, :state_event]
# Validate label names in advance
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index d835dce2ded..aa43e1dffd9 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -109,7 +109,7 @@ module API
# POST /projects/:id/merge_requests
#
post ":id/merge_requests" do
- authorize! :write_merge_request, user_project
+ authorize! :create_merge_request, user_project
required_attributes! [:source_branch, :target_branch, :title]
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description]
@@ -149,7 +149,7 @@ module API
put ":id/merge_request/:merge_request_id" do
attrs = attributes_for_keys [:target_branch, :assignee_id, :title, :state_event, :description]
merge_request = user_project.merge_requests.find(params[:merge_request_id])
- authorize! :modify_merge_request, merge_request
+ authorize! :update_merge_request, merge_request
# Ensure source_branch is not specified
if params[:source_branch].present?
diff --git a/lib/api/project_snippets.rb b/lib/api/project_snippets.rb
index 54f2555903f..22ce3c6a066 100644
--- a/lib/api/project_snippets.rb
+++ b/lib/api/project_snippets.rb
@@ -46,7 +46,7 @@ module API
# Example Request:
# POST /projects/:id/snippets
post ":id/snippets" do
- authorize! :write_project_snippet, user_project
+ authorize! :create_project_snippet, user_project
required_attributes! [:title, :file_name, :code, :visibility_level]
attrs = attributes_for_keys [:title, :file_name, :visibility_level]
@@ -74,7 +74,7 @@ module API
# PUT /projects/:id/snippets/:snippet_id
put ":id/snippets/:snippet_id" do
@snippet = user_project.snippets.find(params[:snippet_id])
- authorize! :modify_project_snippet, @snippet
+ authorize! :update_project_snippet, @snippet
attrs = attributes_for_keys [:title, :file_name, :visibility_level]
attrs[:content] = params[:code] if params[:code].present?
@@ -98,7 +98,7 @@ module API
delete ":id/snippets/:snippet_id" do
begin
@snippet = user_project.snippets.find(params[:snippet_id])
- authorize! :modify_project_snippet, @snippet
+ authorize! :update_project_snippet, @snippet
@snippet.destroy
rescue
not_found!('Snippet')