Updates remote user creation process to preserve username and email (#27334)
This change makes sure that the original username and email are always preserved when creating a user coming from a remote cluster.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4b0ae20ef7
Коммит
9733694854
@@ -249,13 +249,9 @@ func (scs *Service) insertSyncUser(rctx request.CTX, user *model.User, _ *model.
|
|||||||
// ensure the new user is created with system_user role and random password.
|
// ensure the new user is created with system_user role and random password.
|
||||||
user = sanitizeUserForSync(user)
|
user = sanitizeUserForSync(user)
|
||||||
|
|
||||||
// save the original username and email in props (if not already done by another remote)
|
// save the original username and email in props
|
||||||
if _, ok := user.GetProp(KeyRemoteUsername); !ok {
|
user.SetProp(KeyRemoteUsername, user.Username)
|
||||||
user.SetProp(KeyRemoteUsername, user.Username)
|
user.SetProp(KeyRemoteEmail, user.Email)
|
||||||
}
|
|
||||||
if _, ok := user.GetProp(KeyRemoteEmail); !ok {
|
|
||||||
user.SetProp(KeyRemoteEmail, user.Email)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply a suffix to the username until it is unique. Collisions will be quite
|
// Apply a suffix to the username until it is unique. Collisions will be quite
|
||||||
// rare since we are joining a username that is unique at a remote site with a unique
|
// rare since we are joining a username that is unique at a remote site with a unique
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user