(Stuart Lewis) - Fix issue where users are not getting added to the ldap special group correctly, and adjusted some of the logging levels

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3144 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Stuart Lewis
2008-09-19 15:26:33 +00:00
parent 11fcb5f3cf
commit 899c0108f0

View File

@@ -73,21 +73,7 @@ public class LDAPHierarchicalAuthentication
private static Logger log = Logger.getLogger(LDAPHierarchicalAuthentication.class); private static Logger log = Logger.getLogger(LDAPHierarchicalAuthentication.class);
/** LDAP all members group */ /** LDAP all members group */
Group ldapGroup; private Group ldapGroup;
public void init()
{
try
{
String groupName = ConfigurationManager.getProperty("ldap.login.specialgroup");
if ((groupName != null) && (!groupName.trim().equals("")))
{
ldapGroup = Group.findByName(new Context(), groupName);
}
} catch (SQLException e) {
}
}
/** /**
* Let a real auth method return true if it wants. * Let a real auth method return true if it wants.
@@ -144,8 +130,13 @@ public class LDAPHierarchicalAuthentication
{ {
if (!context.getCurrentUser().getNetid().equals("")) if (!context.getCurrentUser().getNetid().equals(""))
{ {
String groupName = ConfigurationManager.getProperty("ldap.login.specialgroup");
if ((groupName != null) && (!groupName.trim().equals("")))
{
ldapGroup = Group.findByName(new Context(), groupName);
if (ldapGroup == null) if (ldapGroup == null)
{ // Oops - the group isn't there. {
// Oops - the group isn't there.
log.warn(LogManager.getHeader(context, log.warn(LogManager.getHeader(context,
"ldap_specialgroup", "ldap_specialgroup",
"Group defined in ldap.login.specialgroup does not exist")); "Group defined in ldap.login.specialgroup does not exist"));
@@ -156,7 +147,8 @@ public class LDAPHierarchicalAuthentication
} }
} }
} }
catch (NullPointerException npe) { }
catch (Exception npe) {
// The user is not an LDAP user, so we don't need to worry about them // The user is not an LDAP user, so we don't need to worry about them
} }
return new int[0]; return new int[0];
@@ -468,7 +460,7 @@ public class LDAPHierarchicalAuthentication
// Ambiguous user, can't continue // Ambiguous user, can't continue
} else { } else {
log.warn(LogManager.getHeader(context, "got DN", resultDN)); log.debug(LogManager.getHeader(context, "got DN", resultDN));
return resultDN; return resultDN;
} }
} }