From 48fb02e3839c30667733e59415d98c373467876b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 20 Jan 2013 11:38:20 +0000 Subject: [PATCH] Split "Manage documents" permission into create, edit and delete permissions (#12401). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11206 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/document.rb | 2 +- app/views/documents/index.html.erb | 2 +- app/views/documents/show.html.erb | 4 +++- ...30110122628_split_documents_permissions.rb | 23 +++++++++++++++++++ lib/redmine.rb | 4 +++- test/fixtures/roles.yml | 13 +++++++---- test/unit/user_test.rb | 2 +- 7 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 db/migrate/20130110122628_split_documents_permissions.rb diff --git a/app/models/document.rb b/app/models/document.rb index 3fcdcee46..0c2ce1736 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -19,7 +19,7 @@ class Document < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :project belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id" - acts_as_attachable :delete_permission => :manage_documents + acts_as_attachable :delete_permission => :delete_documents acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project acts_as_event :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"}, diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb index 28fc74684..84567741e 100644 --- a/app/views/documents/index.html.erb +++ b/app/views/documents/index.html.erb @@ -1,6 +1,6 @@
<%= link_to l(:label_document_new), new_project_document_path(@project), :class => 'icon icon-add', - :onclick => 'showAndScrollTo("add-document", "document_title"); return false;' if User.current.allowed_to?(:manage_documents, @project) %> + :onclick => 'showAndScrollTo("add-document", "document_title"); return false;' if User.current.allowed_to?(:add_documents, @project) %>