Skip to content

Commit

Permalink
More hotfixes (#5676)
Browse files Browse the repository at this point in the history
* More hotfixes

* rubo
  • Loading branch information
farhatahmad authored Jan 23, 2024
1 parent c75f20c commit ffd5af2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
7 changes: 5 additions & 2 deletions db/data/20231117151542_add_email_on_sign_up_permission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
class AddEmailOnSignUpPermission < ActiveRecord::Migration[7.1]
def up
email_permission = Permission.create!(name: 'EmailOnSignup')
admin = Role.find_by(name: 'Administrator')
admin = Role.where(name: 'Administrator')

values = [{ role: admin, permission: email_permission, value: 'true' }]
values = []
admin.each do |adm|
values << { role: adm, permission: email_permission, value: 'true' }
end

Role.where.not(name: 'Administrator').each do |role|
values.push({ role:, permission: email_permission, value: 'false' })
Expand Down
13 changes: 13 additions & 0 deletions db/data/20240123184213_fix_access_to_visibilities_value.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

class FixAccessToVisibilitiesValue < ActiveRecord::Migration[7.1]
def up
# rubocop:disable Rails/SkipsModelValidations
Permission.find_by(name: 'AccessToVisibilities').role_permissions.where(value: 'false').update_all(value: Recording::VISIBILITIES.values)
# rubocop:enable Rails/SkipsModelValidations
end

def down
raise ActiveRecord::IrreversibleMigration
end
end

0 comments on commit ffd5af2

Please sign in to comment.