Skip to content
Permalink
Browse files
[FIXED JENKINS-11660] safe-guard against missing (or lack of access t…
…o) attributes
  • Loading branch information
kohsuke committed Nov 8, 2011
1 parent aa3bdb0 commit e3f419e80e5e775e26e6a1ed359a82e87b5ea510
Showing 1 changed file with 32 additions and 1 deletion.
@@ -99,10 +99,41 @@ protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticati
!isAccountDisabled(usr),
true, true, true,
groups.toArray(new GrantedAuthority[groups.size()]),
usr.fullName(), usr.emailAddress(), usr.telephoneNumber().toString()
getFullName(usr), getEmailAddress(usr), getTelehoneNumber(usr)
).updateUserInfo();
}

private String getTelehoneNumber(IADsUser usr) {
try {
Object t = usr.telephoneNumber();
return t==null ? null : t.toString();
} catch (ComException e) {
if (e.getHRESULT()==0x8000500D) // see http://support.microsoft.com/kb/243440
return null;
throw e;
}
}

private String getEmailAddress(IADsUser usr) {
try {
return usr.emailAddress();
} catch (ComException e) {
if (e.getHRESULT()==0x8000500D) // see http://support.microsoft.com/kb/243440
return null;
throw e;
}
}

private String getFullName(IADsUser usr) {
try {
return usr.fullName();
} catch (ComException e) {
if (e.getHRESULT()==0x8000500D) // see http://support.microsoft.com/kb/243440
return null;
throw e;
}
}

private boolean isAccountDisabled(IADsUser usr) {
try {
return usr.accountDisabled();

0 comments on commit e3f419e

Please sign in to comment.