diff --git a/app/controllers/git/blobs_controller.rb b/app/controllers/git/blobs_controller.rb index 24335823a..fa4e75386 100644 --- a/app/controllers/git/blobs_controller.rb +++ b/app/controllers/git/blobs_controller.rb @@ -17,9 +17,11 @@ class Git::BlobsController < Git::BaseController end def edit + authorize! :write, @project end def update + authorize! :write, @project # Here might be callbacks for notification purposes: # @git_repository.after_update_file do |repo, sha| # end diff --git a/app/views/git/blobs/show.html.haml b/app/views/git/blobs/show.html.haml index c94f11f38..14f6e6164 100644 --- a/app/views/git/blobs/show.html.haml +++ b/app/views/git/blobs/show.html.haml @@ -23,7 +23,7 @@ #{link_to "Blame", blame_commit_path(@project, @commit_hash, @path)} #{link_to "History", commits_path(@project, @treeish, @path)} - else - #{link_to "Edit", edit_blob_path(@project, @treeish, @path) if choose_render_way(@blob) == :text} + #{link_to "Edit", edit_blob_path(@project, @treeish, @path) if choose_render_way(@blob) == :text and can? :write, @project} #{link_to "Raw", raw_path(@project, @treeish, @path)} #{link_to "Blame", blame_path(@project, @treeish, @path)} #{link_to "History", commits_path(@project, @treeish, @path)}