From: Jean-Philippe Lang Date: Wed, 7 Jun 2017 20:25:25 +0000 (+0000) Subject: New permission: view news (#7068). X-Git-Tag: 3.4.0~63 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9b0fcdaf2b6f965f0777dbedbaf0158cf7d927bf;p=redmine.git New permission: view news (#7068). Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@16639 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/config/locales/de.yml b/config/locales/de.yml index 0519dd976..99a7c1ddf 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -926,6 +926,7 @@ de: permission_manage_files: Dateien verwalten permission_manage_issue_relations: Ticket-Beziehungen verwalten permission_manage_members: Mitglieder verwalten + permission_view_news: News ansehen permission_manage_news: News verwalten permission_manage_project_activities: Aktivitäten (Zeiterfassung) verwalten permission_manage_public_queries: Öffentliche Filter verwalten diff --git a/config/locales/en.yml b/config/locales/en.yml index a8eca2dfe..f2a8cbc0b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -497,6 +497,7 @@ en: permission_view_time_entries: View spent time permission_edit_time_entries: Edit time logs permission_edit_own_time_entries: Edit own time logs + permission_view_news: View news permission_manage_news: Manage news permission_comment_news: Comment news permission_view_documents: View documents diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 653c49bab..ce9bb3eda 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -509,6 +509,7 @@ fr: permission_view_time_entries: Voir le temps passé permission_edit_time_entries: Modifier les temps passés permission_edit_own_time_entries: Modifier son propre temps passé + permission_view_news: Voir les annonces permission_manage_news: Gérer les annonces permission_comment_news: Commenter les annonces permission_view_documents: Voir les documents diff --git a/config/locales/ja.yml b/config/locales/ja.yml index a018e7240..8d1ae6ce1 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -427,6 +427,7 @@ ja: permission_edit_time_entries: 作業時間の編集 permission_edit_own_time_entries: 自身が記入した作業時間の編集 permission_manage_project_activities: 作業分類 (時間管理) の管理 + permission_view_news: ニュースの閲覧 permission_manage_news: ニュースの管理 permission_comment_news: ニュースへのコメント permission_view_documents: 文書の閲覧 diff --git a/db/migrate/20170418090031_add_view_news_to_all_existing_roles.rb b/db/migrate/20170418090031_add_view_news_to_all_existing_roles.rb new file mode 100644 index 000000000..6f851a1f1 --- /dev/null +++ b/db/migrate/20170418090031_add_view_news_to_all_existing_roles.rb @@ -0,0 +1,9 @@ +class AddViewNewsToAllExistingRoles < ActiveRecord::Migration + def up + Role.all.each { |role| role.add_permission! :view_news } + end + + def down + # nothing to revert + end +end diff --git a/lib/redmine.rb b/lib/redmine.rb index 6c53cfb19..729fcb561 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -131,7 +131,7 @@ Redmine::AccessControl.map do |map| end map.project_module :news do |map| - map.permission :view_news, {:news => [:index, :show]}, :public => true, :read => true + map.permission :view_news, {:news => [:index, :show]}, :read => true map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy], :attachments => :upload}, :require => :member map.permission :comment_news, {:comments => :create} end diff --git a/lib/redmine/default_data/loader.rb b/lib/redmine/default_data/loader.rb index 18e707908..680e84199 100644 --- a/lib/redmine/default_data/loader.rb +++ b/lib/redmine/default_data/loader.rb @@ -65,6 +65,7 @@ module Redmine :view_calendar, :log_time, :view_time_entries, + :view_news, :comment_news, :view_documents, :view_wiki_pages, @@ -91,6 +92,7 @@ module Redmine :view_calendar, :log_time, :view_time_entries, + :view_news, :comment_news, :view_documents, :view_wiki_pages, @@ -109,6 +111,7 @@ module Redmine :view_gantt, :view_calendar, :view_time_entries, + :view_news, :comment_news, :view_documents, :view_wiki_pages, @@ -123,6 +126,7 @@ module Redmine :view_gantt, :view_calendar, :view_time_entries, + :view_news, :view_documents, :view_wiki_pages, :view_wiki_edits, diff --git a/test/fixtures/roles.yml b/test/fixtures/roles.yml index 2365795b3..ce7e1b4e7 100644 --- a/test/fixtures/roles.yml +++ b/test/fixtures/roles.yml @@ -36,6 +36,7 @@ roles_001: - :view_time_entries - :edit_time_entries - :delete_time_entries + - :view_news - :manage_news - :comment_news - :view_documents @@ -92,6 +93,7 @@ roles_002: - :log_time - :view_time_entries - :edit_own_time_entries + - :view_news - :manage_news - :comment_news - :view_documents @@ -137,6 +139,7 @@ roles_003: - :view_calendar - :log_time - :view_time_entries + - :view_news - :manage_news - :comment_news - :view_documents @@ -174,6 +177,7 @@ roles_004: - :view_calendar - :log_time - :view_time_entries + - :view_news - :comment_news - :view_documents - :view_wiki_pages @@ -200,6 +204,7 @@ roles_005: - :view_gantt - :view_calendar - :view_time_entries + - :view_news - :view_documents - :view_wiki_pages - :view_wiki_edits