setting.activedirectory.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?php
  2. global $myUser,$_,$conf;
  3. User::check_access('activedirectory','configure');
  4. require_once(__DIR__.SLASH.'ActiveDirectoryGroup.class.php');
  5. ?>
  6. <div class="row">
  7. <div class="col-md-12"><br>
  8. <div class="btn btn btn-success ml-2 float-right" onclick="activedirectory_setting_save();"><i class="fas fa-check"></i> Enregistrer</div>
  9. <h3>Réglages Active Directory</h3>
  10. <div class="clear"></div>
  11. <hr>
  12. </div>
  13. </div>
  14. <div class="row">
  15. <div class="col-md-12">
  16. <div class="tab-container noPrint">
  17. <ul class="nav nav-tabs" role="tablist">
  18. <li class="nav-item"><a data-toggle="tab" class="nav-link active" href="#tab-settings" aria-controls="tab-settings" aria-selected="false">Paramètres</a></li>
  19. <li class="nav-item"><a data-toggle="tab" class="nav-link" href="#tab-mapping" aria-controls="tab-mapping" aria-selected="false">Correspondances</a></li>
  20. </ul>
  21. </div>
  22. <div class="tab-content">
  23. <!-- Onglet Général -->
  24. <div class="tab-pane show active in" id="tab-settings" role="tabpanel" aria-labelledby="tab-settings"><br>
  25. <?php echo Configuration::html('activedirectory'); ?>
  26. <hr>
  27. <div class="activedirectory-test-connection mt-3 mb-3">
  28. <div class="btn btn btn-primary float-right" onclick="activedirectory_connection_check();"><i class="fas fa-network-wired"></i> Tester la connexion</div>
  29. <legend>Récapitulatif de connexion</legend>
  30. <div class="clear"></div>
  31. <!-- Reload ajax partie bloc config -->
  32. <div class="row">
  33. <div class="col-sm-4">
  34. <div id="reach-connection" class="card text-center">
  35. <div class="card-body">
  36. <div class="label">
  37. <h5 class="">Connexion au serveur AD distant</h5>
  38. <small class="card-subtitle mb-2 text-muted">Test de connexion au serveur</small>
  39. </div>
  40. <span class="d-block mt-2 mb-3">
  41. <h2 class="card-icon d-block"><i class="fas fa-question-circle"></i></h2>
  42. </span>
  43. <small class="card-text text-muted">
  44. <div>IP Serveur : <span class="text-<?php echo !empty($conf->get('activedirectory_server'))?'primary':'danger'; ?>"><?php echo !empty($conf->get('activedirectory_server')) ? $conf->get('activedirectory_server') : "Non renseigné"; ?></span></div>
  45. <div>Port / Port SSL : <span class="text-<?php echo !empty($conf->get('activedirectory_port')) && !empty($conf->get('activedirectory_ssl_port'))?'primary':'danger'; ?>"><?php echo !empty($conf->get('activedirectory_port')) && !empty($conf->get('activedirectory_ssl_port')) ? $conf->get('activedirectory_port').' / '.$conf->get('activedirectory_ssl_port') : "Non renseigné"; ?></span></div>
  46. <div>Domaine : <span class="text-<?php echo !empty($conf->get('activedirectory_domain'))?'primary':'danger'; ?>"><?php echo !empty($conf->get('activedirectory_domain')) ? $conf->get('activedirectory_domain') : "Non renseigné"; ?></span></div>
  47. </small>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="col-sm-4">
  52. <div id="reader-connection" class="card text-center">
  53. <div class="card-body">
  54. <div class="label">
  55. <h5 class="">Connexion avec le compte AD <i>read-only</i></h5>
  56. <small class="card-subtitle mb-2 text-muted">Test d'identification avec le compte AD lecture seule</small>
  57. </div>
  58. <span class="d-block mt-2 mb-3">
  59. <h2 class="card-icon d-block"><i class="fas fa-question-circle"></i></h2>
  60. </span>
  61. <small class="card-text text-muted">
  62. <div class="text-fullbreak">CN : <span class="text-<?php echo !empty($conf->get('activedirectory_reader_login'))?'primary':'danger'; ?>"><?php echo !empty($conf->get('activedirectory_reader_login')) ? $conf->get('activedirectory_reader_login') : "Non renseigné"; ?></span></div>
  63. <div>Mot de passe : <span class="text-<?php echo !empty($conf->get('activedirectory_reader_password'))?'success':'danger'; ?>"><?php echo !empty($conf->get('activedirectory_reader_password')) ? "Renseigné" : "Non renseigné"; ?></span></div>
  64. </small>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="col-sm-4">
  69. <div id="users-connection" class="card text-center">
  70. <div class="card-body">
  71. <div class="label">
  72. <h5 class="">Récupération d'utilisateurs</h5>
  73. <small class="card-subtitle mb-2 text-muted">Test de récupération d'utilisateurs depuis l'AD</small>
  74. </div>
  75. <span class="d-block mt-2 mb-3">
  76. <h2 class="card-icon d-block"><i class="fas fa-question-circle"></i></h2>
  77. </span>
  78. <small class="card-text text-muted">
  79. <div class="mb-2">Racine des utilisateurs :
  80. <?php if(!empty($conf->get('activedirectory_users_root'))): ?>
  81. <ul class="pl-3 list-unstyled">
  82. <?php foreach(explode(';',$conf->get('activedirectory_users_root')) as $userRoot): ?>
  83. <li class="text-primary text-fullbreak"><?php echo $userRoot; ?></li>
  84. <?php endforeach; ?>
  85. </ul>
  86. <?php else: ?>
  87. <span class="text-danger">Non renseigné</span>
  88. <?php endif; ?>
  89. </div>
  90. <div>Racine des groupes :
  91. <?php if(!empty($conf->get('activedirectory_groups_root'))): ?>
  92. <ul class="pl-3 list-unstyled">
  93. <?php foreach(explode(';',$conf->get('activedirectory_groups_root')) as $userRoot): ?>
  94. <li class="text-primary text-fullbreak"><?php echo $userRoot; ?></li>
  95. <?php endforeach; ?>
  96. </ul>
  97. <?php else: ?>
  98. <span class="text-danger">Non renseigné</span>
  99. <?php endif; ?>
  100. </div>
  101. </small>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. <div class="tab-pane" id="tab-mapping" role="mapping" aria-labelledby="tab-mapping"><br>
  109. <div class="col-md-12">
  110. <legend>Correspondance Groupe / Rang / Établissement</legend>
  111. <table id="group-rank-firm" class="table table-striped table-bordered table-hover table-group-rank-firm">
  112. <thead>
  113. <tr>
  114. <th>Groupe AD</th>
  115. <th>Rang</th>
  116. <th>Établissement</th>
  117. <th></th>
  118. </tr>
  119. <tr id="ad-correspondance" data-id="" class="" data-action="activedirectory_group_save">
  120. <th><input type="text" name="ad-group" id="ad-group" placeholder="Nom du groupe" class="form-control"></th>
  121. <th>
  122. <select name="ad-rank" id="ad-rank" class="form-control">
  123. <option value="">-</option>
  124. <?php foreach(Rank::loadAll() as $rank): ?>
  125. <option value="<?php echo $rank->id; ?>"><?php echo $rank->label; ?></option>
  126. <?php endforeach; ?>
  127. </select>
  128. </th>
  129. <th>
  130. <select name="ad-firm" id="ad-firm" class="form-control">
  131. <option value="">-</option>
  132. <?php foreach(Firm::loadAll() as $firm): ?>
  133. <?php if($firm->has_plugin('fr.sys1.activedirectory')): ?>
  134. <option value="<?php echo $firm->id; ?>"><?php echo $firm->label; ?></option>
  135. <?php endif; ?>
  136. <?php endforeach; ?>
  137. </select>
  138. </th>
  139. <th class="text-center"><div class="btn btn-success" onclick="activedirectory_group_save();"><i class="fas fa-check"></i></div></th>
  140. </tr>
  141. </thead>
  142. <tbody>
  143. <tr data-id="{{id}}" class="hidden">
  144. <td>{{adgroup}}</td>
  145. <td>{{rankLabel}}</td>
  146. <td>{{firmLabel}}</td>
  147. <td class="text-center action-buttons">
  148. <div class="btn btn-info btn-squarred btn-mini" onclick="activedirectory_group_edit(this);"><i class="fas fa-pencil-alt"></i></div>
  149. <div class="btn btn-danger btn-squarred btn-mini" onclick="activedirectory_group_delete(this);"><i class="fas fa-times"></i></div>
  150. </td>
  151. </tr>
  152. </tbody>
  153. </table>
  154. <!-- Pagination -->
  155. <ul class="pagination justify-content-center">
  156. <li class="page-item hidden" data-value="{{value}}" title="Voir la page {{label}}" onclick="$(this).parent().find('li').removeClass('active');$(this).addClass('active');activedirectory_group_search()">
  157. <span class="page-link">{{label}}</span>
  158. </li>
  159. </ul>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. </div>