Add hasEmailAddress to IdentifiedUser

This allows validation code to pass in an email address
for checking, and lets IdentifiedUser worry about how
that occurs.

This refactoring opens the door to delegating the check
to backend systems that are not able to supply the entire
valid email list for a user.

Change-Id: I3db2b34d311d0c8f6f5c0cfdaa109d44fd79e264
This commit is contained in:
Shawn Pearce
2014-12-19 15:36:14 -08:00
parent a1f795a12d
commit a33543d7ea
7 changed files with 12 additions and 10 deletions

View File

@@ -270,6 +270,10 @@ public class IdentifiedUser extends CurrentUser {
return diffPref;
}
public boolean hasEmailAddress(String email) {
return getEmailAddresses().contains(email);
}
public Set<String> getEmailAddresses() {
if (emailAddresses == null) {
emailAddresses = state().getEmailAddresses();