2021-02-04 21:08:20 +08:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :user_role do
|
2021-05-02 17:22:59 +08:00
|
|
|
factory :owner_role do
|
|
|
|
name { I18n.t('user_roles.predefined.owner') }
|
|
|
|
permissions { ProjectPermissions.constants.map { |const| ProjectPermissions.const_get(const) } +
|
|
|
|
ExperimentPermissions.constants.map { |const| ExperimentPermissions.const_get(const) } +
|
|
|
|
MyModulePermissions.constants.map { |const| MyModulePermissions.const_get(const) } }
|
|
|
|
predefined { true }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :normal_user_role do
|
|
|
|
name { I18n.t('user_roles.predefined.normal_user') }
|
2021-09-30 17:32:11 +08:00
|
|
|
permissions { PredefinedRoles::NORMAL_USER_PERMISSIONS }
|
2021-05-02 17:22:59 +08:00
|
|
|
predefined { true }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :technician_role do
|
|
|
|
name { I18n.t('user_roles.predefined.technician') }
|
2021-09-30 17:32:11 +08:00
|
|
|
permissions { PredefinedRoles::TECHNICIAN_PERMISSIONS }
|
2021-05-02 17:22:59 +08:00
|
|
|
predefined { true }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :viewer_role do
|
|
|
|
name { I18n.t('user_roles.predefined.viewer') }
|
2021-09-30 17:32:11 +08:00
|
|
|
permissions { PredefinedRoles::VIEWER_PERMISSIONS }
|
2021-05-02 17:22:59 +08:00
|
|
|
predefined { true }
|
|
|
|
end
|
2021-02-04 21:08:20 +08:00
|
|
|
end
|
|
|
|
end
|