configguide-ldap_context.jsp 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <%@ page import="password.pwm.http.bean.ConfigGuideBean" %>
  2. <%@ page import="password.pwm.http.servlet.ConfigGuideServlet" %>
  3. <%@ page import="password.pwm.util.StringUtil" %>
  4. <%@ page import="java.util.Map" %>
  5. <%--
  6. ~ Password Management Servlets (PWM)
  7. ~ http://code.google.com/p/pwm/
  8. ~
  9. ~ Copyright (c) 2006-2009 Novell, Inc.
  10. ~ Copyright (c) 2009-2015 The PWM Project
  11. ~
  12. ~ This program is free software; you can redistribute it and/or modify
  13. ~ it under the terms of the GNU General Public License as published by
  14. ~ the Free Software Foundation; either version 2 of the License, or
  15. ~ (at your option) any later version.
  16. ~
  17. ~ This program is distributed in the hope that it will be useful,
  18. ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. ~ GNU General Public License for more details.
  21. ~
  22. ~ You should have received a copy of the GNU General Public License
  23. ~ along with this program; if not, write to the Free Software
  24. ~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25. --%>
  26. <% JspUtility.setFlag(pageContext, PwmRequest.Flag.HIDE_LOCALE); %>
  27. <% JspUtility.setFlag(pageContext, PwmRequest.Flag.HIDE_THEME); %>
  28. <!DOCTYPE html>
  29. <%@ page language="java" session="true" isThreadSafe="true" contentType="text/html" %>
  30. <% ConfigGuideBean configGuideBean = (ConfigGuideBean) JspUtility.getPwmSession(pageContext).getSessionBean(ConfigGuideBean.class);%>
  31. <% Map<String,String> DEFAULT_FORM = ConfigGuideServlet.defaultForm(configGuideBean.getStoredConfiguration().getTemplate()); %>
  32. <%@ taglib uri="pwm" prefix="pwm" %>
  33. <html dir="<pwm:LocaleOrientation/>">
  34. <%@ include file="fragment/header.jsp" %>
  35. <body class="nihilo">
  36. <link href="<pwm:context/><pwm:url url='/public/resources/configStyle.css'/>" rel="stylesheet" type="text/css"/>
  37. <div id="wrapper">
  38. <div id="header">
  39. <div id="header-center">
  40. <div id="header-page">
  41. <pwm:display key="Title_ConfigGuide" bundle="Config"/>
  42. </div>
  43. <div id="header-title">
  44. <pwm:display key="Title_ConfigGuide_ldap" bundle="Config"/>
  45. </div>
  46. </div>
  47. </div>
  48. <div id="centerbody">
  49. <form id="configForm">
  50. <%@ include file="/WEB-INF/jsp/fragment/message.jsp" %>
  51. <br/>
  52. <div class="setting_outline">
  53. <div class="setting_title">LDAP Contextless Login Root</div>
  54. <div class="setting_body">
  55. Enter the top level LDAP context of your LDAP directory. This sets the top level LDAP container
  56. where an LDAP sub-tree search is performed to find your user entries. If you need to enter multiple
  57. containers, you can use the configuration editor to add them after this guide completes.
  58. <br/><br/>
  59. A default value has been generated but you may need to change it to be appropriate to your directory.
  60. <div class="setting_item">
  61. <b>LDAP Contextless Login Root</b>
  62. <br/>
  63. <button type="button" class="btn" id="button-browse-context"><span class="btn-icon fa fa-sitemap"></span>Browse</button>
  64. <input style="width:400px" class="configStringInput" id="<%=ConfigGuideServlet.PARAM_LDAP_CONTEXT%>" name="<%=ConfigGuideServlet.PARAM_LDAP_CONTEXT%>" value="<%=StringUtil.escapeHtml(configGuideBean.getFormData().get(ConfigGuideServlet.PARAM_LDAP_CONTEXT))%>" placeholder="<%=DEFAULT_FORM.get(ConfigGuideServlet.PARAM_LDAP_CONTEXT)%>" required autofocus/>
  65. </div>
  66. </div>
  67. </div>
  68. <br/>
  69. <div class="setting_outline">
  70. <div class="setting_title">
  71. Administrator Search Filter
  72. </div>
  73. <div class="setting_body">
  74. Enter the LDAP DN of the group used to determining if a user should be given administrator access to this system. Any user
  75. that is a member of this group will be granted administrator access.
  76. <div class="setting_item">
  77. <b>Administrator Group DN</b>
  78. <br/>
  79. <button type="button" class="btn" id="button-browse-adminGroup"><span class="btn-icon fa fa-sitemap"></span>Browse</button>
  80. <input style="width:400px;" class="configStringInput" id="<%=ConfigGuideServlet.PARAM_LDAP_ADMIN_GROUP%>" name="<%=ConfigGuideServlet.PARAM_LDAP_ADMIN_GROUP%>" value="<%=StringUtil.escapeHtml(configGuideBean.getFormData().get(ConfigGuideServlet.PARAM_LDAP_ADMIN_GROUP))%>" placeholder="<%=DEFAULT_FORM.get(ConfigGuideServlet.PARAM_LDAP_ADMIN_GROUP)%>" required/>
  81. <button type="button" id="button-viewAdminMatches" class="btn">
  82. <span class="btn-icon fa fa-eye"></span>
  83. View Matches
  84. </button>
  85. </div>
  86. </div>
  87. </div>
  88. </form>
  89. <br/>
  90. <div id="healthBody" style="border:0; margin:0; padding:0; cursor: pointer">
  91. <div style="text-align: center">
  92. <button class="menubutton" style="margin-left: auto; margin-right: auto">
  93. <pwm:if test="showIcons"><span class="btn-icon fa fa-check"></span></pwm:if>
  94. <pwm:display key="Button_CheckSettings" bundle="Config"/>
  95. </button>
  96. </div>
  97. </div>
  98. <div class="buttonbar">
  99. <button class="btn" id="button_previous">
  100. <pwm:if test="showIcons"><span class="btn-icon fa fa-backward"></span></pwm:if>
  101. <pwm:display key="Button_Previous" bundle="Config"/>
  102. </button>
  103. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  104. <button class="btn" id="button_next">
  105. <pwm:if test="showIcons"><span class="btn-icon fa fa-forward"></span></pwm:if>
  106. <pwm:display key="Button_Next" bundle="Config"/>
  107. </button>
  108. </div>
  109. </div>
  110. <div class="push"></div>
  111. </div>
  112. <pwm:script>
  113. <script type="text/javascript">
  114. function handleFormActivity() {
  115. PWM_GUIDE.updateForm();
  116. clearHealthDiv();
  117. }
  118. function clearHealthDiv() {
  119. PWM_MAIN.getObject('healthBody').innerHTML = PWM_VAR['originalHealthBody'];
  120. }
  121. PWM_GLOBAL['startupFunctions'].push(function(){
  122. PWM_VAR['originalHealthBody'] = PWM_MAIN.getObject('healthBody').innerHTML;
  123. require(["dojo/parser","dijit/TitlePane","dijit/form/Form","dijit/form/ValidationTextBox","dijit/form/NumberSpinner","dijit/form/CheckBox"],function(dojoParser){
  124. dojoParser.parse();
  125. });
  126. checkIfNextEnabled();
  127. PWM_MAIN.addEventHandler('button_next','click',function(){PWM_GUIDE.gotoStep('NEXT')});
  128. PWM_MAIN.addEventHandler('button_previous','click',function(){PWM_GUIDE.gotoStep('PREVIOUS')});
  129. PWM_MAIN.addEventHandler('configForm','input',function(){handleFormActivity()});
  130. PWM_MAIN.addEventHandler('healthBody','click',function(){loadHealth()});
  131. PWM_MAIN.addEventHandler('button-viewAdminMatches','click',function(){
  132. PWM_MAIN.showWaitDialog({loadFunction:function(){
  133. var url = 'ConfigGuide?processAction=viewAdminMatches';
  134. var loadFunction = function(data){
  135. if (data['error']) {
  136. PWM_MAIN.showErrorDialog(data);
  137. } else {
  138. var html = PWM_CONFIG.convertListOfIdentitiesToHtml(data['data']);
  139. PWM_MAIN.showDialog({title:'Matches',text:html});
  140. }
  141. };
  142. PWM_MAIN.ajaxRequest(url,loadFunction);
  143. }});
  144. });
  145. PWM_MAIN.addEventHandler('button-browse-context','click',function(){
  146. UILibrary.editLdapDN(function(value){
  147. PWM_MAIN.getObject('<%=ConfigGuideServlet.PARAM_LDAP_CONTEXT%>').value = value;
  148. handleFormActivity();
  149. })
  150. });
  151. PWM_MAIN.addEventHandler('button-browse-adminGroup','click',function(){
  152. UILibrary.editLdapDN(function(value){
  153. PWM_MAIN.getObject('<%=ConfigGuideServlet.PARAM_LDAP_ADMIN_GROUP%>').value = value;
  154. handleFormActivity();
  155. })
  156. });
  157. });
  158. function checkIfNextEnabled() {
  159. if (PWM_GLOBAL['pwm-health'] === 'GOOD' || PWM_GLOBAL['pwm-health'] === 'CONFIG') {
  160. PWM_MAIN.getObject('button_next').disabled = false;
  161. } else {
  162. PWM_MAIN.getObject('button_next').disabled = true;
  163. }
  164. }
  165. function loadHealth() {
  166. var options = {};
  167. options['sourceUrl'] = 'ConfigGuide?processAction=ldapHealth';
  168. options['showRefresh'] = false;
  169. options['refreshTime'] = -1;
  170. options['finishFunction'] = function(){
  171. PWM_MAIN.closeWaitDialog();
  172. checkIfNextEnabled();
  173. };
  174. PWM_MAIN.showWaitDialog({loadFunction:function(){
  175. PWM_ADMIN.showAppHealth('healthBody', options);
  176. }});
  177. }
  178. </script>
  179. </pwm:script>
  180. <pwm:script-ref url="/public/resources/js/configguide.js"/>
  181. <pwm:script-ref url="/public/resources/js/uilibrary.js"/>
  182. <pwm:script-ref url="/public/resources/js/configmanager.js"/>
  183. <pwm:script-ref url="/public/resources/js/admin.js"/>
  184. <%@ include file="fragment/footer.jsp" %>
  185. </body>
  186. </html>