(Stuart Lewis) - Fix issue where users without a netid (users not authenticated via LDAP) can't login because an NPE is thrown in the getSpecialGroups method of the LDAPHierarchicalAuthentication class

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3143 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Stuart Lewis
2008-09-19 07:03:49 +00:00
parent fa16865ae3
commit 11fcb5f3cf

View File

@@ -140,20 +140,25 @@ public class LDAPHierarchicalAuthentication
{
// Prevents anonymous users from being added to this group, and the second check
// ensures they are LDAP users
if ((context.getCurrentUser() != null) &&
(!context.getCurrentUser().getNetid().equals("")))
try
{
if (ldapGroup == null)
{ // Oops - the group isn't there.
log.warn(LogManager.getHeader(context,
"ldap_specialgroup",
"Group defined in ldap.login.specialgroup does not exist"));
return new int[0];
} else
if (!context.getCurrentUser().getNetid().equals(""))
{
return new int[] { ldapGroup.getID() };
if (ldapGroup == null)
{ // Oops - the group isn't there.
log.warn(LogManager.getHeader(context,
"ldap_specialgroup",
"Group defined in ldap.login.specialgroup does not exist"));
return new int[0];
} else
{
return new int[] { ldapGroup.getID() };
}
}
}
catch (NullPointerException npe) {
// The user is not an LDAP user, so we don't need to worry about them
}
return new int[0];
}