modLdap.class.php 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \defgroup ldap Module ldap
  21. * \brief Module to manage LDAP interfaces with contacts or users
  22. * \file htdocs/core/modules/modLdap.class.php
  23. * \ingroup ldap
  24. * \brief Description and activation file for the module LDAP
  25. */
  26. include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
  27. /**
  28. * Class to describe and enable module Ldap
  29. */
  30. class modLdap extends DolibarrModules
  31. {
  32. /**
  33. * Constructor. Define names, constants, directories, boxes, permissions
  34. *
  35. * @param DoliDB $db Database handler
  36. */
  37. public function __construct($db)
  38. {
  39. $this->db = $db;
  40. $this->numero = 200;
  41. $this->family = "interface";
  42. // Module position in the family on 2 digits ('01', '10', '20', ...)
  43. $this->module_position = '30';
  44. // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
  45. $this->name = preg_replace('/^mod/i', '', get_class($this));
  46. $this->description = "Synchronisation Ldap";
  47. // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
  48. $this->version = 'dolibarr';
  49. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  50. // Name of image file used for this module.
  51. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
  52. // If file is in module/images directory, use this->picto=DOL_URL_ROOT.'/module/images/file.png'
  53. $this->picto = 'technic';
  54. // Data directories to create when module is enabled
  55. $this->dirs = array("/ldap/temp");
  56. // Config pages
  57. $this->config_page_url = array("ldap.php");
  58. // Dependencies
  59. $this->hidden = false; // A condition to hide module
  60. $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
  61. $this->requiredby = array(); // List of module ids to disable if this one is disabled
  62. $this->conflictwith = array(); // List of module class names as string this module is in conflict with
  63. $this->phpmin = array(5, 6); // Minimum version of PHP required by module
  64. // Constants
  65. $this->const = array(
  66. 0=>array('LDAP_SERVER_TYPE', 'chaine', 'openldap', '', 0),
  67. 1=>array('LDAP_SERVER_PROTOCOLVERSION', 'chaine', '3', '', 0),
  68. 2=>array('LDAP_SERVER_HOST', 'chaine', 'localhost', '', 0),
  69. 3=>array('LDAP_USER_DN', 'chaine', 'ou=users,dc=example,dc=com', '', 0),
  70. 4=>array('LDAP_GROUP_DN', 'chaine', 'ou=groups,dc=example,dc=com', '', 0),
  71. 5=>array('LDAP_FILTER_CONNECTION', 'chaine', '&(objectClass=inetOrgPerson)', '', 0),
  72. 6=>array('LDAP_FIELD_LOGIN', 'chaine', 'uid', '', 0),
  73. 7=>array('LDAP_FIELD_FULLNAME', 'chaine', 'cn', '', 0),
  74. 8=>array('LDAP_FIELD_NAME', 'chaine', 'sn', '', 0),
  75. 9=>array('LDAP_FIELD_FIRSTNAME', 'chaine', 'givenname', '', 0),
  76. 10=>array('LDAP_FIELD_MAIL', 'chaine', 'mail', '', 0),
  77. 11=>array('LDAP_FIELD_PHONE', 'chaine', 'telephonenumber', '', 0),
  78. 12=>array('LDAP_FIELD_FAX', 'chaine', 'facsimiletelephonenumber', '', 0),
  79. 13=>array('LDAP_FIELD_MOBILE', 'chaine', 'mobile', '', 0),
  80. 14=>array('LDAP_GROUP_FILTER', 'chaine', '&(objectClass=groupOfNames)', '', 0),
  81. );
  82. // Boxes
  83. $this->boxes = array();
  84. // Permissions
  85. $this->rights = array();
  86. $this->rights_class = 'ldap';
  87. }
  88. }