ldap_source.rb 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :ldap_source do
  4. sequence(:name) { |n| "Source #{n}" }
  5. active { true }
  6. created_by_id { 1 }
  7. updated_by_id { 1 }
  8. trait :with_config do
  9. preferences do
  10. {
  11. 'host_url' => ENV['IMPORT_LDAP_ENDPOINT'],
  12. 'options' => { 'dc=foo,dc=example,dc=com'=>'dc=foo,dc=example,dc=com' },
  13. 'option' => 'dc=foo,dc=example,dc=com',
  14. 'base_dn' => 'dc=foo,dc=example,dc=com',
  15. 'bind_user' => ENV['IMPORT_LDAP_USER'],
  16. 'bind_pw' => ENV['IMPORT_LDAP_PASSWORD'],
  17. 'wizardData' =>
  18. { 'backend_user_attributes' =>
  19. { 'dn' => 'dn (e.g., cn=nb,dc=foo,dc=example,dc=com)',
  20. 'cn' => 'cn (e.g., Nicole)',
  21. 'sn' => 'sn (e.g., Braun)',
  22. 'uid' => 'uid (e.g., nb)',
  23. 'uidnumber' => 'uidnumber (e.g., 5000)',
  24. 'gidnumber' => 'gidnumber (e.g., 5000)',
  25. 'userpassword' => 'userpassword (e.g., testnb)',
  26. 'homedirectory' => 'homedirectory (e.g., /home/nb)',
  27. 'loginshell' => 'loginshell (e.g., /bin/sh)',
  28. 'gecos' => 'gecos (e.g., Comments)',
  29. 'mail' => 'mail (e.g., nb@example.com)',
  30. 'telephonenumber' => 'telephonenumber (e.g., 110)',
  31. 'roomnumber' => 'roomnumber (e.g., 0200)' },
  32. 'backend_groups' =>
  33. { 'cn=admin,ou=groups,dc=foo,dc=example,dc=com' => 'cn=admin,ou=groups,dc=foo,dc=example,dc=com',
  34. 'cn=1st level,ou=groups,dc=foo,dc=example,dc=com' => 'cn=1st level,ou=groups,dc=foo,dc=example,dc=com',
  35. 'cn=2nd level,ou=groups,dc=foo,dc=example,dc=com' => 'cn=2nd level,ou=groups,dc=foo,dc=example,dc=com',
  36. 'cn=sales,ou=groups,dc=foo,dc=example,dc=com' => 'cn=sales,ou=groups,dc=foo,dc=example,dc=com' },
  37. 'user_attributes' =>
  38. { 'login' => 'Login',
  39. 'firstname' => 'First name',
  40. 'lastname' => 'Last name',
  41. 'email' => 'Email',
  42. 'web' => 'Web',
  43. 'phone' => 'Phone',
  44. 'mobile' => 'Mobile',
  45. 'fax' => 'Fax',
  46. 'department' => 'Department',
  47. 'address' => 'Address',
  48. 'note' => 'Note' },
  49. 'roles' => { '1' => 'Admin', '2' => 'Agent', '3' => 'Customer' } },
  50. 'user_uid' => 'uid',
  51. 'user_filter' => '(objectClass=posixaccount)',
  52. 'group_uid' => 'dn',
  53. 'group_filter' => '(objectClass=posixgroup)',
  54. 'user_attributes' => { 'cn' => 'firstname', 'sn' => 'lastname', 'mail' => 'email', 'uid' => 'login', 'telephonenumber' => 'phone' },
  55. 'group_role_map' =>
  56. { 'cn=admin,ou=groups,dc=foo,dc=example,dc=com' => ['1'], 'cn=1st level,ou=groups,dc=foo,dc=example,dc=com' => ['2'] },
  57. 'unassigned_users' => 'sigup_roles'
  58. }
  59. end
  60. end
  61. end
  62. end