001
014
015 package com.liferay.portal.security.ldap;
016
017 import com.liferay.registry.Registry;
018 import com.liferay.registry.RegistryUtil;
019 import com.liferay.registry.ServiceTracker;
020
021 import java.util.Properties;
022
023
026 public class LDAPSettingsUtil {
027
028 public static String getAuthSearchFilter(
029 long ldapServerId, long companyId, String emailAddress,
030 String screenName, String userId)
031 throws Exception {
032
033 return _getInstance().getAuthSearchFilter(
034 ldapServerId, companyId, emailAddress, screenName, userId);
035 }
036
037 public static Properties getContactExpandoMappings(
038 long ldapServerId, long companyId)
039 throws Exception {
040
041 return _getInstance().getContactExpandoMappings(
042 ldapServerId, companyId);
043 }
044
045 public static Properties getContactMappings(
046 long ldapServerId, long companyId)
047 throws Exception {
048
049 return _getInstance().getContactMappings(ldapServerId, companyId);
050 }
051
052 public static Properties getGroupMappings(long ldapServerId, long companyId)
053 throws Exception {
054
055 return _getInstance().getGroupMappings(ldapServerId, companyId);
056 }
057
058 public static long getPreferredLDAPServerId(
059 long companyId, String screenName) {
060
061 return _getInstance().getPreferredLDAPServerId(companyId, screenName);
062 }
063
064 public static String getPropertyPostfix(long ldapServerId) {
065 return _getInstance().getPropertyPostfix(ldapServerId);
066 }
067
068 public static Properties getUserExpandoMappings(
069 long ldapServerId, long companyId)
070 throws Exception {
071
072 return _getInstance().getUserExpandoMappings(ldapServerId, companyId);
073 }
074
075 public static Properties getUserMappings(long ldapServerId, long companyId)
076 throws Exception {
077
078 return _getInstance().getUserMappings(ldapServerId, companyId);
079 }
080
081 public static boolean isExportEnabled(long companyId) {
082 return _getInstance().isExportEnabled(companyId);
083 }
084
085 public static boolean isExportGroupEnabled(long companyId) {
086 return _getInstance().isExportGroupEnabled(companyId);
087 }
088
089 public static boolean isImportEnabled(long companyId) {
090 return _getInstance().isImportEnabled(companyId);
091 }
092
093 public static boolean isImportOnStartup(long companyId) {
094 return _getInstance().isImportOnStartup(companyId);
095 }
096
097 public static boolean isPasswordPolicyEnabled(long companyId) {
098 return _getInstance().isPasswordPolicyEnabled(companyId);
099 }
100
101 private static LDAPSettings _getInstance() {
102 return _instance._serviceTracker.getService();
103 }
104
105 private LDAPSettingsUtil() {
106 Registry registry = RegistryUtil.getRegistry();
107
108 _serviceTracker = registry.trackServices(LDAPSettings.class);
109
110 _serviceTracker.open();
111 }
112
113 private static final LDAPSettingsUtil _instance = new LDAPSettingsUtil();
114
115 private final ServiceTracker<LDAPSettings, LDAPSettings> _serviceTracker;
116
117 }