setting.activedirectory.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. global $myUser,$_,$conf;
  3. if(!$myUser->can('activedirectory','configure')) throw new Exception("Permissions insuffisantes",403);
  4. require_once(__DIR__.SLASH.'ActiveDirectoryGroup.class.php');
  5. ?>
  6. <div class="row">
  7. <div class="col-md-12">
  8. <br>
  9. <h3>Réglages Active Directory</h3>
  10. <hr/>
  11. <?php
  12. if($myUser!=false){ ?>
  13. <div id="active-directory-form-settings">
  14. <form action="action.php?action=activedirectory_activedirectory_settings_save" method="POST">
  15. <button type="submit" class="btn btn btn-success float-right"><i class="fas fa-check"></i> Enregistrer</button>
  16. <legend>Configuration de l'AD</legend><br>
  17. <div class="clear"></div>
  18. <div class="row">
  19. <div class="col-md-4">
  20. <label>Serveur :</label>
  21. <input type="text" name="ad-server" value="<?php echo $conf->get('plugin_activedirectory_server'); ?>" placeholder="ad.server.fr" class="form-control">
  22. </div>
  23. <div class="col-md-4">
  24. <label>Port :</label>
  25. <input type="text" name="ad-port" value="<?php echo $conf->get('plugin_activedirectory_port'); ?>" placeholder="389" class="form-control">
  26. </div>
  27. <div class="col-md-4">
  28. <label>Port SSL :</label>
  29. <input type="text" name="ad-ssl-port" value="<?php echo $conf->get('plugin_activedirectory_ssl_port'); ?>" placeholder="636" class="form-control">
  30. </div>
  31. </div><br>
  32. <div class="row">
  33. <div class="col-md-8">
  34. <label>Racine des utilisateurs :</label>
  35. <input type="text" name="ad-user-root" value="<?php echo $conf->get('plugin_activedirectory_user_root'); ?>" placeholder="ou=people,dc=idleman,dc=fr" class="form-control">
  36. </div>
  37. </div><br>
  38. <div class="row">
  39. <div class="col-md-8">
  40. <label>Racine des groupes :</label>
  41. <input type="text" name="ad-group-root" value="<?php echo $conf->get('plugin_activedirectory_group_root'); ?>" placeholder="ou=people,dc=idleman,dc=fr" class="form-control">
  42. </div>
  43. <div class="col-md-4">
  44. <label>Domaine :</label>
  45. <input type="text" name="ad-domain" value="<?php echo $conf->get('plugin_activedirectory_domain'); ?>" placeholder="@MONSITE.LOCAL" class="form-control">
  46. </div>
  47. </div><br>
  48. <div class="row">
  49. <div class="col-md-8">
  50. <label>CN Lecture seule :</label>
  51. <small class="text-muted">utilisé pour acceder aux groupes et aux utilisateurs</small>
  52. <input type="text" name="ad-reader-login" value="<?php echo $conf->get('plugin_activedirectory_reader_login'); ?>" placeholder="ou=people,dc=idleman,dc=fr" class="form-control">
  53. </div>
  54. <div class="col-md-4">
  55. <label>Mot de passe lecture seule :</label>
  56. <small class="text-muted">(Optionnel)</small>
  57. <input type="password" data-type="password" name="ad-reader-password" value="<?php echo $conf->get('plugin_activedirectory_reader_password'); ?>" placeholder="" class="form-control">
  58. </div>
  59. </div><br>
  60. <div class="row">
  61. <div class="col-md-8">
  62. <label>CN Administrateur :</label>
  63. <small class="text-muted">(Optionnel), utilisé pour les changements de mots de passe uniquement</small>
  64. <input type="text" name="ad-admin-login" value="<?php echo $conf->get('plugin_activedirectory_admin_login'); ?>" placeholder="ou=people,dc=idleman,dc=fr" class="form-control">
  65. </div>
  66. <div class="col-md-4">
  67. <label>Mot de passe Administrateur :</label>
  68. <small class="text-muted">(Optionnel)</small>
  69. <input type="password" data-type="password" name="ad-admin-password" value="<?php echo $conf->get('plugin_activedirectory_admin_password'); ?>" placeholder="" class="form-control">
  70. </div>
  71. </div><br>
  72. <div class="row mt-3">
  73. <!-- search results -->
  74. <div class="col-xl-12">
  75. <h4>Meta informations</h4>
  76. <p>Vous pouvez remplir des méta champs pour les utilisateurs, ces méta champs sont requis par certains plugins et peuvent être renseigné
  77. depuis l'AD via la syntaxe : <code>Libellé:Type:nom-champ-ad:nom-meta</code> avec une ligne par champs</p>
  78. <textarea class="form-control" name="ad-metafields"><?php echo $conf->get('plugin_activedirectory_metafields'); ?></textarea>
  79. </div>
  80. </div>
  81. </form>
  82. <hr/>
  83. <form id="ad-correspondance" data-id="" class="" data-action="activedirectory_activedirectory_save_link" action="action.php?action=activedirectory_activedirectory_save_link" method="POST">
  84. <legend>Correspondance Groupe / Rang / Établissement</legend><br>
  85. <div class="row">
  86. <div class="col-md-4">
  87. <label>Nom du groupe AD :</label>
  88. <input type="text" name="ad-group" id="ad-group" placeholder="Nom du groupe" class="form-control">
  89. </div>
  90. <div class="col-md-3">
  91. <label>Rang :</label>
  92. <select name="ad-rank" id="ad-rank" class="form-control">
  93. <?php
  94. $ranks = new Rank();
  95. $ranks = $ranks->populate();
  96. foreach($ranks as $rank)
  97. echo '<option value="'.$rank->getId().'">'.$rank->getLabel().'</option>';
  98. ?>
  99. </select>
  100. </div>
  101. <div class="col-md-3">
  102. <label>Établissement :</label>
  103. <select name="ad-firm" id="ad-firm" class="form-control">
  104. <?php
  105. $firms = new Firm();
  106. $firms = $firms->populate();
  107. foreach($firms as $firm)
  108. echo '<option value="'.$firm->id.'">'.$firm->label.'</option>';
  109. ?>
  110. </select>
  111. </div>
  112. <div class="col-md-2 position-relative text-right">
  113. <div class="btn btn-success noLabel" onclick="activedirectory_activedirectory_save_link();"><i class="fas fa-check"></i> Valider</div>
  114. </div>
  115. </div>
  116. </form>
  117. <table id="group-rank-firm" class="table table-striped table-bordered table-hover table-group-rank-firm ">
  118. <thead>
  119. <tr>
  120. <th>Groupe</th>
  121. <th>Rang</th>
  122. <th>Établissement</th>
  123. <th></th>
  124. </tr>
  125. </thead>
  126. <?php
  127. $rank_groups = ActiveDirectoryGroup::loadAll(array());
  128. $firms = Firm::loadAll(array());
  129. $rankManager = new Rank();
  130. $rankManager = $rankManager->populate();
  131. $rankAnnuary = array();
  132. foreach($rankManager as $rank)
  133. $rankAnnuary[$rank->getId()] = $rank->getLabel();
  134. foreach($rank_groups as $rank_group){
  135. ?>
  136. <tr data-id="<?php echo $rank_group->id; ?>">
  137. <td><?php echo $rank_group->adgroup ?></td>
  138. <td><?php echo $rankAnnuary[$rank_group->rank] ?></td>
  139. <td><?php echo Firm::load(array('id'=>$rank_group->firm))->label ?></td>
  140. <td class="text-center action-buttons">
  141. <div class="btn btn-info btn-squarred btn-mini" onclick="activedirectory_activedirectory_edit_link(this);"><i class="fas fa-pencil-alt"></i></div>
  142. <a class="btn btn-danger btn-squarred btn-mini" onclick="return confirm('Voulez-vous vraiment supprimer cet élément ?')" href="action.php?action=activedirectory_activedirectory_delete_link&groupId=<?php echo urlencode($rank_group->id); ?>"><i class="fas fa-times"></i></a>
  143. </td>
  144. </tr>
  145. <?php } ?>
  146. </table>
  147. </div>
  148. <?php } else { ?>
  149. <div id="main" class="wrapper clearfix">
  150. <article>
  151. <h3>Vous devez être connecté</h3>
  152. </article>
  153. </div>
  154. <?php } ?>
  155. </div>
  156. </div>