mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
(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:
@@ -140,20 +140,25 @@ public class LDAPHierarchicalAuthentication
|
|||||||
{
|
{
|
||||||
// Prevents anonymous users from being added to this group, and the second check
|
// Prevents anonymous users from being added to this group, and the second check
|
||||||
// ensures they are LDAP users
|
// ensures they are LDAP users
|
||||||
if ((context.getCurrentUser() != null) &&
|
try
|
||||||
(!context.getCurrentUser().getNetid().equals("")))
|
|
||||||
{
|
{
|
||||||
if (ldapGroup == null)
|
if (!context.getCurrentUser().getNetid().equals(""))
|
||||||
{ // 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() };
|
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];
|
return new int[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user