Commit a792488e authored by Matt Tucker's avatar Matt Tucker Committed by matt

Renamed posixEnabled to posixMode (JM-377).

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@2698 b35dd754-fafc-0310-a699-88a17e54d16e
parent f887cf77
...@@ -109,7 +109,7 @@ will be used for authentication and loading single users, but will not be used t ...@@ -109,7 +109,7 @@ will be used for authentication and loading single users, but will not be used t
the default value is <tt>member</tt></li> the default value is <tt>member</tt></li>
<li>ldap.groupDescriptionField -- the field name that holds the description a group. If this property is not set, <li>ldap.groupDescriptionField -- the field name that holds the description a group. If this property is not set,
the default value is <tt>description</tt></li> the default value is <tt>description</tt></li>
<li>ldap.posixEnabled -- a value of "true" means that users are stored within the group by their user name alone. <li>ldap.posixMode -- a value of "true" means that users are stored within the group by their user name alone.
A value of "false" means that users are stored by their entire DN within the group. If this property is not set, A value of "false" means that users are stored by their entire DN within the group. If this property is not set,
the default value is <tt>false</tt></li> the default value is <tt>false</tt></li>
<li>ldap.groupSearchFilter -- the search filter that should be used when loading groups. If this property is not set, <li>ldap.groupSearchFilter -- the search filter that should be used when loading groups. If this property is not set,
......
...@@ -29,7 +29,9 @@ import java.util.Hashtable; ...@@ -29,7 +29,9 @@ import java.util.Hashtable;
/** /**
* Centralized administration of LDAP connections. The getInstance() method * Centralized administration of LDAP connections. The getInstance() method
* should be used to get an instace. The following configure this manager:<ul> * should be used to get an instace. The following properties configure this manager:
*
* <ul>
* <li>ldap.host</li> * <li>ldap.host</li>
* <li>ldap.port</li> * <li>ldap.port</li>
* <li>ldap.baseDN</li> * <li>ldap.baseDN</li>
...@@ -45,7 +47,7 @@ import java.util.Hashtable; ...@@ -45,7 +47,7 @@ import java.util.Hashtable;
* <li>ldap.groupNameField</li> * <li>ldap.groupNameField</li>
* <li>ldap.groupMemberField</li> * <li>ldap.groupMemberField</li>
* <li>ldap.groupDescriptionField</li> * <li>ldap.groupDescriptionField</li>
* <li>ldap.posixEnabled</li> * <li>ldap.posixMode</li>
* <li>ldap.groupSearchFilter</li> * <li>ldap.groupSearchFilter</li>
* <li>ldap.debugEnabled</li> * <li>ldap.debugEnabled</li>
* <li>ldap.sslEnabled</li> * <li>ldap.sslEnabled</li>
...@@ -77,7 +79,7 @@ public class LdapManager { ...@@ -77,7 +79,7 @@ public class LdapManager {
private String groupNameField = "cn"; private String groupNameField = "cn";
private String groupMemberField = "member"; private String groupMemberField = "member";
private String groupDescriptionField = "description"; private String groupDescriptionField = "description";
private boolean posixEnabled = false; private boolean posixMode = false;
private String groupSearchFilter = null; private String groupSearchFilter = null;
private static LdapManager instance = new LdapManager(); private static LdapManager instance = new LdapManager();
...@@ -140,8 +142,8 @@ public class LdapManager { ...@@ -140,8 +142,8 @@ public class LdapManager {
if (JiveGlobals.getXMLProperty("ldap.groupDescriptionField") != null) { if (JiveGlobals.getXMLProperty("ldap.groupDescriptionField") != null) {
this.groupDescriptionField = JiveGlobals.getXMLProperty("ldap.groupDescriptionField"); this.groupDescriptionField = JiveGlobals.getXMLProperty("ldap.groupDescriptionField");
} }
if (JiveGlobals.getXMLProperty("ldap.posixEnabled") != null) { if (JiveGlobals.getXMLProperty("ldap.posixMode") != null) {
this.posixEnabled = Boolean.valueOf(JiveGlobals.getXMLProperty("ldap.posixEnabled")); this.posixMode = Boolean.valueOf(JiveGlobals.getXMLProperty("ldap.posixMode"));
} }
if (JiveGlobals.getXMLProperty("ldap.groupSearchFilter") != null) { if (JiveGlobals.getXMLProperty("ldap.groupSearchFilter") != null) {
this.groupSearchFilter = JiveGlobals.getXMLProperty("ldap.groupSearchFilter"); this.groupSearchFilter = JiveGlobals.getXMLProperty("ldap.groupSearchFilter");
...@@ -197,7 +199,7 @@ public class LdapManager { ...@@ -197,7 +199,7 @@ public class LdapManager {
Log.debug("\t groupNameField: " + groupNameField); Log.debug("\t groupNameField: " + groupNameField);
Log.debug("\t groupMemberField: " + groupMemberField); Log.debug("\t groupMemberField: " + groupMemberField);
Log.debug("\t groupDescriptionField: " + groupDescriptionField); Log.debug("\t groupDescriptionField: " + groupDescriptionField);
Log.debug("\t posixEnabled: " + posixEnabled); Log.debug("\t posixMode: " + posixMode);
Log.debug("\t groupSearchFilter: " + groupSearchFilter); Log.debug("\t groupSearchFilter: " + groupSearchFilter);
} }
} }
...@@ -230,7 +232,7 @@ public class LdapManager { ...@@ -230,7 +232,7 @@ public class LdapManager {
} }
// Set up the environment for creating the initial context // Set up the environment for creating the initial context
Hashtable env = new Hashtable(); Hashtable<String, Object> env = new Hashtable<String, Object>();
env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
env.put(Context.PROVIDER_URL, getProviderURL(baseDN)); env.put(Context.PROVIDER_URL, getProviderURL(baseDN));
if (sslEnabled) { if (sslEnabled) {
...@@ -290,7 +292,7 @@ public class LdapManager { ...@@ -290,7 +292,7 @@ public class LdapManager {
DirContext ctx = null; DirContext ctx = null;
try { try {
// See if the user authenticates. // See if the user authenticates.
Hashtable env = new Hashtable(); Hashtable<String, Object> env = new Hashtable<String, Object>();
env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
env.put(Context.PROVIDER_URL, getProviderURL(baseDN)); env.put(Context.PROVIDER_URL, getProviderURL(baseDN));
if (sslEnabled) { if (sslEnabled) {
...@@ -324,7 +326,7 @@ public class LdapManager { ...@@ -324,7 +326,7 @@ public class LdapManager {
catch (Exception ignored) { } catch (Exception ignored) { }
try { try {
// See if the user authenticates. // See if the user authenticates.
Hashtable env = new Hashtable(); Hashtable<String, Object> env = new Hashtable<String, Object>();
// Use a custom initial context factory if specified. Otherwise, use the default. // Use a custom initial context factory if specified. Otherwise, use the default.
env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
env.put(Context.PROVIDER_URL, getProviderURL(alternateBaseDN)); env.put(Context.PROVIDER_URL, getProviderURL(alternateBaseDN));
...@@ -864,25 +866,27 @@ public class LdapManager { ...@@ -864,25 +866,27 @@ public class LdapManager {
} }
/** /**
* Return the field used to tell if ldap server is posix. * Return true if the LDAP server is operating in Posix mode. By default
* Value of posixEnabled defaults to false. * false is returned. When in Posix mode, users are stored within a group
* by their username alone. When not enabled, users are stored in a group using
* their entire DN.
* *
* @return the field used to tell if ldap server is posix. * @return true if posix mode is being used by the LDAP server.
*/ */
public boolean getPosixEnabled() { public boolean isPosixMode() {
return posixEnabled; return posixMode;
} }
/** /**
* Sets the field used to tell if ldap server is posix. * Sets whether the LDAP server is operating in Posix mode. When in Posix mode,
* Value of posixEnabled defaults to false. * users are stored within a group by their username alone. When not enabled,
* users are stored in a group using their entire DN.
* *
* @param posixEnabled the field used to tell if ldap server is posix. * @param posixMode true if posix mode is being used by the LDAP server.
*/ */
public void setPosixEnabled(boolean posixEnabled) { public void setPostfixMode(boolean posixMode) {
this.posixEnabled = posixEnabled; this.posixMode = posixMode;
Boolean b = new Boolean(posixEnabled); JiveGlobals.setXMLProperty("ldap.posixEnabled", String.valueOf(posixMode));
JiveGlobals.setXMLProperty("ldap.posixEnabled", b.toString());
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment