Moved CreateUser function int into user.go

This commit is contained in:
Kelvin Clement Mwinuka
2023-12-22 16:17:29 +03:00
parent 408495078d
commit a11a5b4709
2 changed files with 18 additions and 18 deletions

View File

@@ -261,6 +261,24 @@ func (user *User) Replace(new *User) {
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 {
if password[0] == '#' {
return "SHA256"