mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
REST API: remove merging of fields on updates
we use PUT verb not PATCH. We keep merging only to allow to preserve hidden/encrypted fields. This is a backward incompatible change, but is necessary to avoid unexpected issues. You have to pass complete objects on updates. Fixes #1088 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -2668,29 +2668,7 @@ func TestLoginAfterUserUpdateEmptyPwd(t *testing.T) {
|
||||
user, _, err := httpdtest.AddUser(getTestUser(usePubKey), http.StatusCreated)
|
||||
assert.NoError(t, err)
|
||||
user.Password = ""
|
||||
user.PublicKeys = []string{}
|
||||
// password and public key should remain unchanged
|
||||
_, _, err = httpdtest.UpdateUser(user, http.StatusOK, "")
|
||||
assert.NoError(t, err)
|
||||
conn, client, err := getSftpClient(user, usePubKey)
|
||||
if assert.NoError(t, err) {
|
||||
defer conn.Close()
|
||||
defer client.Close()
|
||||
assert.NoError(t, checkBasicSFTP(client))
|
||||
}
|
||||
_, err = httpdtest.RemoveUser(user, http.StatusOK)
|
||||
assert.NoError(t, err)
|
||||
err = os.RemoveAll(user.GetHomeDir())
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestLoginAfterUserUpdateEmptyPubKey(t *testing.T) {
|
||||
usePubKey := true
|
||||
user, _, err := httpdtest.AddUser(getTestUser(usePubKey), http.StatusCreated)
|
||||
assert.NoError(t, err)
|
||||
user.Password = ""
|
||||
user.PublicKeys = []string{}
|
||||
// password and public key should remain unchanged
|
||||
// password should remain unchanged
|
||||
_, _, err = httpdtest.UpdateUser(user, http.StatusOK, "")
|
||||
assert.NoError(t, err)
|
||||
conn, client, err := getSftpClient(user, usePubKey)
|
||||
|
||||
Reference in New Issue
Block a user