%
/**
* Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
%>
<%
boolean ldapAuthEnabled = ParamUtil.getBoolean(request, "settings(" + PropsKeys.LDAP_AUTH_ENABLED +")", PortalLDAPUtil.isAuthEnabled(company.getCompanyId()));
boolean ldapAuthRequired = ParamUtil.getBoolean(request, "settings(" + PropsKeys.LDAP_AUTH_REQUIRED +")", PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.LDAP_AUTH_REQUIRED));
String ldapBaseProviderUrl = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_BASE_PROVIDER_URL +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_BASE_PROVIDER_URL));
String ldapBaseDN = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_BASE_DN +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_BASE_DN));
String ldapSecurityPrincipal = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_SECURITY_PRINCIPAL +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_SECURITY_PRINCIPAL));
String ldapSecurityCredentials = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_SECURITY_CREDENTIALS +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_SECURITY_CREDENTIALS));
String ldapAuthSearchFilter = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_AUTH_SEARCH_FILTER +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_AUTH_SEARCH_FILTER));
String ldapImportUserSearchFilter = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_IMPORT_USER_SEARCH_FILTER +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_IMPORT_USER_SEARCH_FILTER));
String ldapImportGroupSearchFilter = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_IMPORT_GROUP_SEARCH_FILTER +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_IMPORT_GROUP_SEARCH_FILTER));
boolean ldapImportEnabled = ParamUtil.getBoolean(request, "settings(" + PropsKeys.LDAP_IMPORT_ENABLED +")", PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.LDAP_IMPORT_ENABLED, PropsValues.LDAP_IMPORT_ENABLED));
boolean ldapImportOnStartup = ParamUtil.getBoolean(request, "settings(" + PropsKeys.LDAP_IMPORT_ON_STARTUP +")", PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.LDAP_IMPORT_ON_STARTUP));
long ldapImportInterval = ParamUtil.getLong(request, "settings(" + PropsKeys.LDAP_IMPORT_INTERVAL +")", PrefsPropsUtil.getLong(company.getCompanyId(), PropsKeys.LDAP_IMPORT_INTERVAL));
boolean ldapExportEnabled = ParamUtil.getBoolean(request, "settings(" + PropsKeys.LDAP_EXPORT_ENABLED +")", PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.LDAP_EXPORT_ENABLED, PropsValues.LDAP_EXPORT_ENABLED));
String ldapUsersDN = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_USERS_DN +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_USERS_DN));
String ldapUserDefaultObjectClasses = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_USER_DEFAULT_OBJECT_CLASSES +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_USER_DEFAULT_OBJECT_CLASSES));
String ldapGroupsDN = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_GROUPS_DN +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_GROUPS_DN));
boolean ldapPasswordPolicyEnabled = ParamUtil.getBoolean(request, "settings(" + PropsKeys.LDAP_PASSWORD_POLICY_ENABLED +")", PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.LDAP_PASSWORD_POLICY_ENABLED));
String ldapUserMappings = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_USER_MAPPINGS +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_USER_MAPPINGS));
String[] userMappingArray = ldapUserMappings.split("\n");
String userMappingScreenName = StringPool.BLANK;
String userMappingPassword = StringPool.BLANK;
String userMappingEmailAddress = StringPool.BLANK;
String userMappingFullName = StringPool.BLANK;
String userMappingFirstName = StringPool.BLANK;
String userMappingLastName = StringPool.BLANK;
String userMappingJobTitle = StringPool.BLANK;
String userMappingGroup = StringPool.BLANK;
for (int i = 0 ; i < userMappingArray.length ; i++) {
if (userMappingArray[i].indexOf("=") == -1) {
continue;
}
String mapping[] = userMappingArray[i].split("=");
if (mapping.length != 2) {
continue;
}
if (mapping[0].equals("screenName")) {
userMappingScreenName = mapping[1];
}
else if (mapping[0].equals("password")) {
userMappingPassword = mapping[1];
}
else if (mapping[0].equals("emailAddress")) {
userMappingEmailAddress = mapping[1];
}
else if (mapping[0].equals("fullName")) {
userMappingFullName = mapping[1];
}
else if (mapping[0].equals("firstName")) {
userMappingFirstName = mapping[1];
}
else if (mapping[0].equals("lastName")) {
userMappingLastName = mapping[1];
}
else if (mapping[0].equals("jobTitle")) {
userMappingJobTitle = mapping[1];
}
else if (mapping[0].equals("group")) {
userMappingGroup = mapping[1];
}
mapping[1] = "";
}
String ldapGroupMappings = ParamUtil.getString(request, "settings(" + PropsKeys.LDAP_GROUP_MAPPINGS +")", PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_GROUP_MAPPINGS));
String[] groupMappingArray = ldapGroupMappings.split("\n");
String groupMappingGroupName = StringPool.BLANK;
String groupMappingDescription = StringPool.BLANK;
String groupMappingUser = StringPool.BLANK;
for (int i = 0 ; i < groupMappingArray.length ; i++) {
if (userMappingArray[i].indexOf("=") == -1) {
continue;
}
String mapping[] = groupMappingArray[i].split("=");
if (mapping.length != 2) {
continue;
}
if (mapping[0].equals("groupName")) {
groupMappingGroupName = mapping[1];
}
else if (mapping[0].equals("description")) {
groupMappingDescription = mapping[1];
}
else if (mapping[0].equals("user")) {
groupMappingUser = mapping[1];
}
}
%>