feat(dataservices): unify access methods and abstract away redundant code [EE-5628] (#9115)
This commit is contained in:
@@ -87,7 +87,7 @@ func (handler *Handler) userUpdate(w http.ResponseWriter, r *http.Request) *http
|
||||
return httperror.Forbidden("Permission denied to update user to administrator role", httperrors.ErrResourceAccessDenied)
|
||||
}
|
||||
|
||||
user, err := handler.DataStore.User().User(portainer.UserID(userID))
|
||||
user, err := handler.DataStore.User().Read(portainer.UserID(userID))
|
||||
if handler.DataStore.IsErrObjectNotFound(err) {
|
||||
return httperror.NotFound("Unable to find a user with the specified identifier inside the database", err)
|
||||
} else if err != nil {
|
||||
@@ -125,7 +125,7 @@ func (handler *Handler) userUpdate(w http.ResponseWriter, r *http.Request) *http
|
||||
user.TokenIssueAt = time.Now().Unix()
|
||||
}
|
||||
|
||||
err = handler.DataStore.User().UpdateUser(user.ID, user)
|
||||
err = handler.DataStore.User().Update(user.ID, user)
|
||||
if err != nil {
|
||||
return httperror.InternalServerError("Unable to persist user changes inside the database", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user