2023-07-12 07:47:08 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-05 00:41:40 +00:00
|
|
|
# Pre-create base role
|
|
|
|
UserRole.everyone
|
|
|
|
|
|
|
|
# Create default roles defined in config file
|
|
|
|
default_roles = YAML.load_file(Rails.root.join('config', 'roles.yml'))
|
|
|
|
|
2023-12-01 16:07:19 +00:00
|
|
|
default_roles.each_value do |config|
|
2022-07-05 00:41:40 +00:00
|
|
|
UserRole.create_with(position: config['position'], permissions_as_keys: config['permissions'], highlighted: true).find_or_create_by(name: config['name'])
|
|
|
|
end
|