mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
NOISSUE - Fix SSO User metadata update (#3203)
Signed-off-by: dusan <borovcanindusan1@gmail.com>
This commit is contained in:
+11
-1
@@ -299,7 +299,9 @@ func (svc service) Update(ctx context.Context, session authn.Session, id string,
|
||||
return User{}, errors.Wrap(svcerr.ErrUpdateEntity, err)
|
||||
}
|
||||
if u.AuthProvider != "" {
|
||||
if usr.FirstName != nil || usr.LastName != nil || usr.ProfilePicture != nil {
|
||||
if changed(usr.FirstName, u.FirstName) ||
|
||||
changed(usr.LastName, u.LastName) ||
|
||||
changed(usr.ProfilePicture, u.ProfilePicture) {
|
||||
return User{}, svcerr.ErrExternalAuthProviderCouldNotUpdate
|
||||
}
|
||||
}
|
||||
@@ -804,3 +806,11 @@ func sanitizeForUsername(s string, maxLen int) string {
|
||||
|
||||
return cleaned
|
||||
}
|
||||
|
||||
func changed(updated *string, old string) bool {
|
||||
if updated == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return *updated != old
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user