From b674e80128a2658aaf153c0a8413665b7ae07285 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 7 Jun 2017 20:20:22 +0000 Subject: [PATCH] New Permission: View Forum (#4866). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@16637 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- ...0419144536_add_view_messages_to_all_existing_roles.rb | 9 +++++++++ lib/redmine.rb | 2 +- lib/redmine/default_data/loader.rb | 4 ++++ test/fixtures/roles.yml | 5 +++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20170419144536_add_view_messages_to_all_existing_roles.rb diff --git a/db/migrate/20170419144536_add_view_messages_to_all_existing_roles.rb b/db/migrate/20170419144536_add_view_messages_to_all_existing_roles.rb new file mode 100644 index 000000000..d010ba497 --- /dev/null +++ b/db/migrate/20170419144536_add_view_messages_to_all_existing_roles.rb @@ -0,0 +1,9 @@ +class AddViewMessagesToAllExistingRoles < ActiveRecord::Migration + def up + Role.all.each { |role| role.add_permission! :view_messages } + end + + def down + # nothing to revert + end +end diff --git a/lib/redmine.rb b/lib/redmine.rb index e3ff60fd1..6c53cfb19 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -169,7 +169,7 @@ Redmine::AccessControl.map do |map| end map.project_module :boards do |map| - map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true + map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :read => true map.permission :add_messages, {:messages => [:new, :reply, :quote], :attachments => :upload} map.permission :edit_messages, {:messages => :edit, :attachments => :upload}, :require => :member map.permission :edit_own_messages, {:messages => :edit, :attachments => :upload}, :require => :loggedin diff --git a/lib/redmine/default_data/loader.rb b/lib/redmine/default_data/loader.rb index 0d36dbba8..18e707908 100644 --- a/lib/redmine/default_data/loader.rb +++ b/lib/redmine/default_data/loader.rb @@ -71,6 +71,7 @@ module Redmine :view_wiki_edits, :edit_wiki_pages, :delete_wiki_pages, + :view_messages, :add_messages, :edit_own_messages, :view_files, @@ -94,6 +95,7 @@ module Redmine :view_documents, :view_wiki_pages, :view_wiki_edits, + :view_messages, :add_messages, :edit_own_messages, :view_files, @@ -111,6 +113,7 @@ module Redmine :view_documents, :view_wiki_pages, :view_wiki_edits, + :view_messages, :add_messages, :view_files, :browse_repository, @@ -123,6 +126,7 @@ module Redmine :view_documents, :view_wiki_pages, :view_wiki_edits, + :view_messages, :view_files, :browse_repository, :view_changesets] diff --git a/test/fixtures/roles.yml b/test/fixtures/roles.yml index 0ed7aa13b..2365795b3 100644 --- a/test/fixtures/roles.yml +++ b/test/fixtures/roles.yml @@ -50,6 +50,7 @@ roles_001: - :protect_wiki_pages - :delete_wiki_pages - :rename_wiki_pages + - :view_messages - :add_messages - :edit_messages - :delete_messages @@ -102,6 +103,7 @@ roles_002: - :edit_wiki_pages - :protect_wiki_pages - :delete_wiki_pages + - :view_messages - :add_messages - :edit_own_messages - :delete_own_messages @@ -145,6 +147,7 @@ roles_003: - :view_wiki_edits - :edit_wiki_pages - :delete_wiki_pages + - :view_messages - :add_messages - :manage_boards - :view_files @@ -176,6 +179,7 @@ roles_004: - :view_wiki_pages - :view_wiki_edits - :edit_wiki_pages + - :view_messages - :add_messages - :view_files - :manage_files @@ -199,6 +203,7 @@ roles_005: - :view_documents - :view_wiki_pages - :view_wiki_edits + - :view_messages - :view_files - :browse_repository - :view_changesets -- 2.39.5