mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-14 19:37:51 +08:00
24 lines
765 B
Ruby
24 lines
765 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AddMissingRepositoryPermissions < ActiveRecord::Migration[6.1]
|
|
NORMAL_USER_PERMISSIONS = [
|
|
RepositoryPermissions::COLUMNS_UPDATE,
|
|
RepositoryPermissions::COLUMNS_DELETE
|
|
].freeze
|
|
|
|
def change
|
|
reversible do |dir|
|
|
dir.up do
|
|
@normal_user_role = UserRole.find_predefined_normal_user_role
|
|
@normal_user_role.permissions = @normal_user_role.permissions | NORMAL_USER_PERMISSIONS
|
|
@normal_user_role.save(validate: false)
|
|
end
|
|
|
|
dir.down do
|
|
@normal_user_role = UserRole.find_predefined_normal_user_role
|
|
@normal_user_role.permissions = @normal_user_role.permissions - NORMAL_USER_PERMISSIONS
|
|
@normal_user_role.save(validate: false)
|
|
end
|
|
end
|
|
end
|
|
end
|