mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-10 10:20:08 +08:00
Moved CreateUser function int into user.go
This commit is contained in:
@@ -417,21 +417,3 @@ func (acl *ACL) AuthorizeConnection(conn *net.Conn, cmd []string, command utils.
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateUser(username string) *User {
|
|
||||||
return &User{
|
|
||||||
Username: username,
|
|
||||||
Enabled: true,
|
|
||||||
NoPassword: false,
|
|
||||||
Passwords: []Password{},
|
|
||||||
IncludedCategories: []string{},
|
|
||||||
ExcludedCategories: []string{},
|
|
||||||
IncludedCommands: []string{},
|
|
||||||
ExcludedCommands: []string{},
|
|
||||||
IncludedKeys: []string{},
|
|
||||||
IncludedReadKeys: []string{},
|
|
||||||
IncludedWriteKeys: []string{},
|
|
||||||
IncludedPubSubChannels: []string{},
|
|
||||||
ExcludedPubSubChannels: []string{},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -261,6 +261,24 @@ func (user *User) Replace(new *User) {
|
|||||||
user.ExcludedPubSubChannels = new.ExcludedPubSubChannels
|
user.ExcludedPubSubChannels = new.ExcludedPubSubChannels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateUser(username string) *User {
|
||||||
|
return &User{
|
||||||
|
Username: username,
|
||||||
|
Enabled: true,
|
||||||
|
NoPassword: false,
|
||||||
|
Passwords: []Password{},
|
||||||
|
IncludedCategories: []string{},
|
||||||
|
ExcludedCategories: []string{},
|
||||||
|
IncludedCommands: []string{},
|
||||||
|
ExcludedCommands: []string{},
|
||||||
|
IncludedKeys: []string{},
|
||||||
|
IncludedReadKeys: []string{},
|
||||||
|
IncludedWriteKeys: []string{},
|
||||||
|
IncludedPubSubChannels: []string{},
|
||||||
|
ExcludedPubSubChannels: []string{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func GetPasswordType(password string) string {
|
func GetPasswordType(password string) string {
|
||||||
if password[0] == '#' {
|
if password[0] == '#' {
|
||||||
return "SHA256"
|
return "SHA256"
|
||||||
|
Reference in New Issue
Block a user