role.rb 728 B

12345678910111213141516171819202122232425262728293031
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :role do
  4. sequence(:name) { |n| "TestRole#{n}" }
  5. created_by_id { 1 }
  6. updated_by_id { 1 }
  7. transient do
  8. permission_names { nil }
  9. end
  10. permissions { Permission.where(name: permission_names) }
  11. factory :agent_role do
  12. permissions { Permission.where(name: 'ticket.agent') }
  13. end
  14. trait :customer do
  15. permissions { Permission.where(name: 'ticket.customer') }
  16. end
  17. trait :admin do
  18. permissions { Permission.where(name: 'admin') }
  19. end
  20. trait :admin_core_workflow do
  21. permissions { Permission.where(name: 'admin.core_workflow') }
  22. end
  23. end
  24. end