mirror of
https://github.com/keycloak/keycloak.git
synced 2026-05-08 08:01:18 -05:00
Allow updating email when email as username is set and edit username disabed
#23438
This commit is contained in:
committed by
Marek Posolda
parent
ddf11ced16
commit
1e4f284e31
@@ -83,6 +83,12 @@ public abstract class AbstractUserProfileProvider<U extends UserProfileProvider>
|
||||
return !realm.isRegistrationEmailAsUsername();
|
||||
}
|
||||
|
||||
if (USER_API.equals(c.getContext())) {
|
||||
if (realm.isRegistrationEmailAsUsername()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return realm.isEditUsernameAllowed();
|
||||
}
|
||||
|
||||
@@ -114,6 +120,12 @@ public abstract class AbstractUserProfileProvider<U extends UserProfileProvider>
|
||||
return true;
|
||||
}
|
||||
|
||||
if (USER_API.equals(c.getContext())) {
|
||||
if (realm.isRegistrationEmailAsUsername()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Profile.isFeatureEnabled(Feature.UPDATE_EMAIL)) {
|
||||
return !(UPDATE_PROFILE.equals(c.getContext()) || ACCOUNT.equals(c.getContext()));
|
||||
}
|
||||
|
||||
@@ -58,6 +58,11 @@ public class LegacyAttributes extends DefaultAttributes {
|
||||
if (UserProfileContext.IDP_REVIEW.equals(context)) {
|
||||
return false;
|
||||
}
|
||||
if (UserProfileContext.USER_API.equals(context)) {
|
||||
if (realm.isRegistrationEmailAsUsername()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !realm.isEditUsernameAllowed();
|
||||
}
|
||||
|
||||
@@ -65,7 +70,8 @@ public class LegacyAttributes extends DefaultAttributes {
|
||||
if (isServiceAccountUser()) {
|
||||
return false;
|
||||
}
|
||||
if (UserProfileContext.IDP_REVIEW.equals(context)) {
|
||||
if (UserProfileContext.IDP_REVIEW.equals(context)
|
||||
|| UserProfileContext.USER_API.equals(context)) {
|
||||
return false;
|
||||
}
|
||||
if (realm.isRegistrationEmailAsUsername() && !realm.isEditUsernameAllowed()) {
|
||||
|
||||
Reference in New Issue
Block a user