diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-05-10 09:46:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-10 09:46:09 -0700 |
commit | d8dd271e43550ab043c2db36c274092d7819fcab (patch) | |
tree | e297c0534a9684d57fc254281cf5cbc3d7c08e0f /app/user.go | |
parent | db6b8f6238853c6e7e48dc8015a0b25f97ee232a (diff) | |
download | chat-d8dd271e43550ab043c2db36c274092d7819fcab.tar.gz chat-d8dd271e43550ab043c2db36c274092d7819fcab.tar.bz2 chat-d8dd271e43550ab043c2db36c274092d7819fcab.zip |
MM-4998 Adding LoginIdAttribute to allow LDAP users to change their login ID without losing their account (#8756)
* Adding LoginIdAttribute
* Modifying LDAP to use loginIDAttribute.
* Adding IDAttribute migration and AD objectGUID support.
* Removing unused idea.
* Fix typo.
Diffstat (limited to 'app/user.go')
-rw-r--r-- | app/user.go | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/app/user.go b/app/user.go index fd8b6b377..2b0442e75 100644 --- a/app/user.go +++ b/app/user.go @@ -382,38 +382,6 @@ func (a *App) GetUserByAuth(authData *string, authService string) (*model.User, } } -func (a *App) GetUserForLogin(loginId string, onlyLdap bool) (*model.User, *model.AppError) { - license := a.License() - ldapAvailable := *a.Config().LdapSettings.Enable && a.Ldap != nil && license != nil && *license.Features.LDAP - - if result := <-a.Srv.Store.User().GetForLogin( - loginId, - *a.Config().EmailSettings.EnableSignInWithUsername && !onlyLdap, - *a.Config().EmailSettings.EnableSignInWithEmail && !onlyLdap, - ldapAvailable, - ); result.Err != nil && result.Err.Id == "store.sql_user.get_for_login.multiple_users" { - // don't fall back to LDAP in this case since we already know there's an LDAP user, but that it shouldn't work - result.Err.StatusCode = http.StatusBadRequest - return nil, result.Err - } else if result.Err != nil { - if !ldapAvailable { - // failed to find user and no LDAP server to fall back on - result.Err.StatusCode = http.StatusBadRequest - return nil, result.Err - } - - // fall back to LDAP server to see if we can find a user - if ldapUser, ldapErr := a.Ldap.GetUser(loginId); ldapErr != nil { - ldapErr.StatusCode = http.StatusBadRequest - return nil, ldapErr - } else { - return ldapUser, nil - } - } else { - return result.Data.(*model.User), nil - } -} - func (a *App) GetUsers(offset int, limit int) ([]*model.User, *model.AppError) { if result := <-a.Srv.Store.User().GetAllProfiles(offset, limit); result.Err != nil { return nil, result.Err |