Bug #1556: Use an enum to express the value of UserAuthenticationType field.
Using an enum instead of a simple String will make easier for us to change the value of this field. FEA: ItEr77S04BugFixing
This commit is contained in:
parent
724237e2ad
commit
a9591cecd6
1 changed files with 19 additions and 3 deletions
|
|
@ -447,12 +447,28 @@ public class UserCRUDController extends BaseCRUDController<User> implements
|
|||
return isLdapUser() || isUserDefaultAdmin();
|
||||
}
|
||||
|
||||
public String getAuthenticationType() {
|
||||
public enum UserAuthenticationType {
|
||||
|
||||
EMPTY(""), DATABASE(_("Database")), LDAP(_("LDAP"));
|
||||
|
||||
private String name;
|
||||
|
||||
private UserAuthenticationType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public UserAuthenticationType getAuthenticationType() {
|
||||
User user = getUser();
|
||||
if (user != null) {
|
||||
return _(user.getUserType());
|
||||
return user.isLibrePlanUser() ? UserAuthenticationType.DATABASE
|
||||
: UserAuthenticationType.LDAP;
|
||||
}
|
||||
return "";
|
||||
return UserAuthenticationType.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue