You are here

README.txt in Simple LDAP 7

Simple LDAP User
================

This module allows authentication to the LDAP directory configured in the
Simple LDAP module. It also provides synchronization services both to and from
LDAP and Drupal. It supports mapping LDAP attributes to Drupal user object
fields (both native, and using Field API).

Configuration
=============

In addition to the configuration available in the administration UI, an
attribute map can be specified in settings.php, using the variable
$conf['simple_ldap_user_attribute_map'].

This variable is an array of arrays, where each of the arrays have the
following items:

* drupal - The field name on the Drupal user. This must be the machine name of
	   the field. To specify Field module fields, prefix the field name with a
	   hash, e.g. '#field_foo'. If no hash prefix is found, it is assumed that the
	   field is a property of the user itself, such as name, pass, mail, etc.

	   This can also be an array of drupal properties or fields. If the array
	   contains more than one entry, synchronization for that map only works in
	   the drupal->ldap direction, and the fields are concatenated with a space
	   separator.

	   Note: If you are mapping a Field module field that does not store its data
	   in a 'value' column, you need to specify the name of the column in the
	   mapping itself using square brackets. See the Country example below.

* ldap - The LDAP attribute on the LDAP user.

Example:
--------
$conf['simple_ldap_user_attribute_map'] = array(

  // Generic example.
  array(
    'drupal' => '#drupal-user-field-machine-name',
    'ldap' => 'ldap-attribute',
  ),

  // First name example.
  array(
    'drupal' => '#field_first_name',
    'ldap' => 'givenName',
  ),

  // Last name example.
  array(
    'drupal' => '#field_last_name',
    'ldap' => 'sn',
  ),

  // Country example.
  array(
    'drupal' => '#field_country[iso2]',
    'ldap' => 'localityName',
  ),

  // Timezone example (saved directly to users table, note there is no '#').
  array(
    'drupal' => 'timezone',
    'ldap' => 'l',
  ),

  // Combined fields example.
  array(
    'drupal' => array(
      '#field_first_name',
      '#field_last_name',
    ),
    'ldap' => 'displayName',
  ),

);

Active Directory Example:
-------------------------
$conf['simple_ldap_user_attribute_map'] = array(
  array(
    'drupal' => '#field_first_name',
    'ldap' => 'givenName',
  ),
  array(
    'drupal' => '#field_last_name',
    'ldap' => 'sn',
  ),
  array(
    'drupal' => array(
      '#field_first_name',
      '#field_last_name',
    ),
    'ldap' => 'CN',
  ),
  array(
    'drupal' => array(
      '#field_first_name',
      '#field_last_name',
    ),
    'ldap' => 'displayName',
  ),
);

Testing
=======

The simpletests provided with this module automatically configure themeselves
to use the active configuration in order to perform a real-world test against
your real LDAP server.

THIS MEANS THAT DATA WILL BE ADDED/DELETED ON YOUR REAL LDAP SERVER!

The simpletests only operate against entries it creates, but in the event of a
failure, the test cannot clean up after itself. If you are testing a specific
configuration, it is recommended to run the test against a development or
staging directory first.

File

simple_ldap_user/README.txt
View source
  1. Simple LDAP User
  2. ================
  3. This module allows authentication to the LDAP directory configured in the
  4. Simple LDAP module. It also provides synchronization services both to and from
  5. LDAP and Drupal. It supports mapping LDAP attributes to Drupal user object
  6. fields (both native, and using Field API).
  7. Configuration
  8. =============
  9. In addition to the configuration available in the administration UI, an
  10. attribute map can be specified in settings.php, using the variable
  11. $conf['simple_ldap_user_attribute_map'].
  12. This variable is an array of arrays, where each of the arrays have the
  13. following items:
  14. * drupal - The field name on the Drupal user. This must be the machine name of
  15. the field. To specify Field module fields, prefix the field name with a
  16. hash, e.g. '#field_foo'. If no hash prefix is found, it is assumed that the
  17. field is a property of the user itself, such as name, pass, mail, etc.
  18. This can also be an array of drupal properties or fields. If the array
  19. contains more than one entry, synchronization for that map only works in
  20. the drupal->ldap direction, and the fields are concatenated with a space
  21. separator.
  22. Note: If you are mapping a Field module field that does not store its data
  23. in a 'value' column, you need to specify the name of the column in the
  24. mapping itself using square brackets. See the Country example below.
  25. * ldap - The LDAP attribute on the LDAP user.
  26. Example:
  27. --------
  28. $conf['simple_ldap_user_attribute_map'] = array(
  29. // Generic example.
  30. array(
  31. 'drupal' => '#drupal-user-field-machine-name',
  32. 'ldap' => 'ldap-attribute',
  33. ),
  34. // First name example.
  35. array(
  36. 'drupal' => '#field_first_name',
  37. 'ldap' => 'givenName',
  38. ),
  39. // Last name example.
  40. array(
  41. 'drupal' => '#field_last_name',
  42. 'ldap' => 'sn',
  43. ),
  44. // Country example.
  45. array(
  46. 'drupal' => '#field_country[iso2]',
  47. 'ldap' => 'localityName',
  48. ),
  49. // Timezone example (saved directly to users table, note there is no '#').
  50. array(
  51. 'drupal' => 'timezone',
  52. 'ldap' => 'l',
  53. ),
  54. // Combined fields example.
  55. array(
  56. 'drupal' => array(
  57. '#field_first_name',
  58. '#field_last_name',
  59. ),
  60. 'ldap' => 'displayName',
  61. ),
  62. );
  63. Active Directory Example:
  64. -------------------------
  65. $conf['simple_ldap_user_attribute_map'] = array(
  66. array(
  67. 'drupal' => '#field_first_name',
  68. 'ldap' => 'givenName',
  69. ),
  70. array(
  71. 'drupal' => '#field_last_name',
  72. 'ldap' => 'sn',
  73. ),
  74. array(
  75. 'drupal' => array(
  76. '#field_first_name',
  77. '#field_last_name',
  78. ),
  79. 'ldap' => 'CN',
  80. ),
  81. array(
  82. 'drupal' => array(
  83. '#field_first_name',
  84. '#field_last_name',
  85. ),
  86. 'ldap' => 'displayName',
  87. ),
  88. );
  89. Testing
  90. =======
  91. The simpletests provided with this module automatically configure themeselves
  92. to use the active configuration in order to perform a real-world test against
  93. your real LDAP server.
  94. THIS MEANS THAT DATA WILL BE ADDED/DELETED ON YOUR REAL LDAP SERVER!
  95. The simpletests only operate against entries it creates, but in the event of a
  96. failure, the test cannot clean up after itself. If you are testing a specific
  97. configuration, it is recommended to run the test against a development or
  98. staging directory first.