From 509d8002386b2fe1db0acfd9e47d674e15c199d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 7 May 2019 15:29:49 +0200 Subject: [PATCH] [30171][30170] Add board view by default - Add show permission to all roles - Add to default settings --- config/settings.yml | 1 + .../20190507132517_add_board_view_to_roles.rb | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 db/migrate/20190507132517_add_board_view_to_roles.rb diff --git a/config/settings.yml b/config/settings.yml index 1fc3d2b39e..867c00fa6b 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -284,6 +284,7 @@ default_projects_modules: serialized: true default: - calendar + - board_view - work_package_tracking - news - time_tracking diff --git a/db/migrate/20190507132517_add_board_view_to_roles.rb b/db/migrate/20190507132517_add_board_view_to_roles.rb new file mode 100644 index 0000000000..c8f4ad3f8e --- /dev/null +++ b/db/migrate/20190507132517_add_board_view_to_roles.rb @@ -0,0 +1,20 @@ +class AddBoardViewToRoles < ActiveRecord::Migration[5.2] + def up + Role + .joins(:role_permissions) + .where("role_permissions.permission = 'view_work_packages'") + .references(:role_permissions) + .find_each do |role| + + role.add_permission! :show_board_views + end + + unless Setting.default_projects_modules.include?('board_view') + Setting.default_projects_modules = Setting.default_projects_mdoules + ['board_view'] + end + end + + def down + # Nothing to do + end +end