[DS-707] Style / readability improvements

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5565 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-22 23:19:13 +00:00
parent 56c6ca1f49
commit d032c565e0
79 changed files with 927 additions and 246 deletions

View File

@@ -188,19 +188,24 @@ public class LDAPAuthentication
{
// e-mail address corresponds to active account
if (eperson.getRequireCertificate())
return CERT_REQUIRED;
else if (!eperson.canLogIn())
return BAD_ARGS;
{
if (ldap.ldapAuthenticate(netid, password, context))
{
context.setCurrentUser(eperson = EPerson.findByNetid(context, netid.toLowerCase()));
log.info(LogManager
.getHeader(context, "authenticate", "type=ldap"));
return SUCCESS;
}
else
return BAD_CREDENTIALS;
return CERT_REQUIRED;
}
else if (!eperson.canLogIn())
{
return BAD_ARGS;
}
if (ldap.ldapAuthenticate(netid, password, context))
{
context.setCurrentUser(eperson = EPerson.findByNetid(context, netid.toLowerCase()));
log.info(LogManager
.getHeader(context, "authenticate", "type=ldap"));
return SUCCESS;
}
else
{
return BAD_CREDENTIALS;
}
}
@@ -240,11 +245,26 @@ public class LDAPAuthentication
{
context.setIgnoreAuthorization(true);
eperson = EPerson.create(context);
if ((ldap.ldapEmail!=null)&&(!ldap.ldapEmail.equals(""))) eperson.setEmail(ldap.ldapEmail);
else eperson.setEmail(netid);
if ((ldap.ldapGivenName!=null)&&(!ldap.ldapGivenName.equals(""))) eperson.setFirstName(ldap.ldapGivenName);
if ((ldap.ldapSurname!=null)&&(!ldap.ldapSurname.equals(""))) eperson.setLastName(ldap.ldapSurname);
if ((ldap.ldapPhone!=null)&&(!ldap.ldapPhone.equals(""))) eperson.setMetadata("phone", ldap.ldapPhone);
if ((ldap.ldapEmail!=null)&&(!ldap.ldapEmail.equals("")))
{
eperson.setEmail(ldap.ldapEmail);
}
else
{
eperson.setEmail(netid);
}
if ((ldap.ldapGivenName!=null)&&(!ldap.ldapGivenName.equals("")))
{
eperson.setFirstName(ldap.ldapGivenName);
}
if ((ldap.ldapSurname!=null)&&(!ldap.ldapSurname.equals("")))
{
eperson.setLastName(ldap.ldapSurname);
}
if ((ldap.ldapPhone!=null)&&(!ldap.ldapPhone.equals("")))
{
eperson.setMetadata("phone", ldap.ldapPhone);
}
eperson.setNetid(netid.toLowerCase());
eperson.setCanLogIn(true);
AuthenticationManager.initEPerson(context, request, eperson);