OAuthRealm: Add user name field to editableAccountFields

Change-Id: I4a2835313059ee7d4f084e0fa46ead50efae7804
This commit is contained in:
David Ostrovsky
2016-10-19 09:29:11 +02:00
parent 98aeaff17e
commit 056979506b

View File

@@ -14,8 +14,6 @@
package com.google.gerrit.server.auth.oauth;
import static com.google.gerrit.reviewdb.client.Account.FieldName.USER_NAME;
import com.google.common.base.Strings;
import com.google.gerrit.extensions.auth.oauth.OAuthLoginProvider;
import com.google.gerrit.extensions.auth.oauth.OAuthUserInfo;
@@ -46,6 +44,9 @@ public class OAuthRealm extends AbstractRealm {
@GerritServerConfig Config config) {
this.loginProviders = loginProviders;
this.editableAccountFields = new HashSet<>();
// User name should be always editable, because not all OAuth providers
// expose them
editableAccountFields.add(FieldName.USER_NAME);
if (config.getBoolean("oauth", null, "allowEditFullName", false)) {
editableAccountFields.add(FieldName.FULL_NAME);
}
@@ -56,7 +57,7 @@ public class OAuthRealm extends AbstractRealm {
@Override
public boolean allowsEdit(FieldName field) {
return field == USER_NAME || editableAccountFields.contains(field);
return editableAccountFields.contains(field);
}
/**