From: Marius Balteanu Date: Sun, 3 Nov 2024 18:48:58 +0000 (+0000) Subject: Set builtin and new roles' user visibility to members_of_visible_projects (#38853). X-Git-Tag: 6.0.0~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f6d2d098949dbea1eab35ce0d30509c531b23245;p=redmine.git Set builtin and new roles' user visibility to members_of_visible_projects (#38853). Patch by Holger Just (user:hjust). git-svn-id: https://svn.redmine.org/redmine/trunk@23198 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/db/migrate/20241103184550_change_builtin_roles_user_visibility.rb b/db/migrate/20241103184550_change_builtin_roles_user_visibility.rb new file mode 100644 index 000000000..4e8b0f7f3 --- /dev/null +++ b/db/migrate/20241103184550_change_builtin_roles_user_visibility.rb @@ -0,0 +1,14 @@ +class ChangeBuiltinRolesUserVisibility < ActiveRecord::Migration[7.2] + def up + # Default to members_of_visible_projects for all newly created roles + change_column_default :roles, :users_visibility, 'members_of_visible_projects' + + # Set the users visibility of the builtin roles (Anonymous and Non-Member) + # to members_of_visible_projects as a saf(er) default. + Role.where.not(builtin: 0).update_all(users_visibility: 'members_of_visible_projects') + end + + def down + change_column_default :roles, :users_visibility, 'all' + end +end