mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-12 19:30:35 +08:00
Removed all usages of custion utils.Filter function in favour of built-in slices DeleteFunc. Updated utils.ReadMessage to read with 8192 sized chunks to reduce the risk of running into a blocking read call when the end of the input is reached.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package acl
|
||||
|
||||
import (
|
||||
"github.com/echovault/echovault/src/utils"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
@@ -105,18 +104,18 @@ func (user *User) UpdateUser(cmd []string) error {
|
||||
continue
|
||||
}
|
||||
if str[0] == '<' {
|
||||
user.Passwords = utils.Filter(user.Passwords, func(password Password) bool {
|
||||
user.Passwords = slices.DeleteFunc(user.Passwords, func(password Password) bool {
|
||||
if strings.EqualFold(password.PasswordType, "SHA256") {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
return password.PasswordValue == str[1:]
|
||||
})
|
||||
continue
|
||||
}
|
||||
if str[0] == '!' {
|
||||
user.Passwords = utils.Filter(user.Passwords, func(password Password) bool {
|
||||
user.Passwords = slices.DeleteFunc(user.Passwords, func(password Password) bool {
|
||||
if strings.EqualFold(password.PasswordType, "plaintext") {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
return password.PasswordValue == str[1:]
|
||||
})
|
||||
|
Reference in New Issue
Block a user