mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-07 21:55:20 +08:00
Viewer role does not see any tasks in archived project [SCI-6616] (#3958)
* Fix viewer role not see any tasks in archived project [SCI-6616] * Fix rollback for add read archive permission migration [SCI-6616]
This commit is contained in:
parent
f75265974e
commit
5cc97122e5
2 changed files with 14 additions and 0 deletions
|
@ -186,6 +186,7 @@ module PermissionExtends
|
|||
ExperimentPermissions::USERS_READ,
|
||||
MyModulePermissions::READ,
|
||||
MyModulePermissions::USERS_READ,
|
||||
MyModulePermissions::READ_ARCHIVED,
|
||||
MyModulePermissions::ACTIVITIES_READ
|
||||
]
|
||||
end
|
||||
|
|
13
db/migrate/20220325101011_add_read_archive_permission.rb
Normal file
13
db/migrate/20220325101011_add_read_archive_permission.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# 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
|
Loading…
Add table
Reference in a new issue