Project

General

Profile

Feature #38853 ยป 0001-Migration-Set-builtin-and-new-roles-user-visibility-.patch

Holger Just, 2024-01-23 12:49

View differences:

db/migrate/20240123112103_change_builtin_roles_user_visibility.rb
1
class ChangeBuiltinRolesUserVisibility < ActiveRecord::Migration[7.1]
2
  def up
3
    # Default to members_of_visible_projects for all newly created roles
4
    change_column_default :roles, :users_visibility, 'members_of_visible_projects'
5

  
6
    # Set the users visibility of the builtin roles (Anonymous and Non-Member)
7
    # to members_of_visible_projects as a saf(er) default.
8
    Role.where.not(builtin: 0).update_all(users_visibility: 'members_of_visible_projects')
9
  end
10

  
11
  def down
12
    change_column_default :roles, :users_visibility, 'all'
13
  end
14
end
    (1-1/1)