mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-14 21:24:54 +08:00
5cc97122e5
* Fix viewer role not see any tasks in archived project [SCI-6616] * Fix rollback for add read archive permission migration [SCI-6616]
13 lines
532 B
Ruby
13 lines
532 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AddReadArchivePermission < ActiveRecord::Migration[6.1]
|
|
def up
|
|
existing_role = UserRole.find_by(name: UserRole.public_send('viewer_role').name)
|
|
existing_role&.update_attribute(:permissions, existing_role.permissions | [MyModulePermissions::READ_ARCHIVED])
|
|
end
|
|
|
|
def down
|
|
existing_role = UserRole.find_by(name: UserRole.public_send('viewer_role').name)
|
|
existing_role&.update_attribute(:permissions, existing_role.permissions - [MyModulePermissions::READ_ARCHIVED])
|
|
end
|
|
end
|