pfug/pfug.go
2023-11-04 01:44:04 +01:00

34 lines
663 B
Go

package pfug
import (
"git.0x0001f346.de/andreas/utils"
)
func CreateGroup(name string) Group {
return Group{
UUID: utils.GenerateNewUUID(),
Name: name,
Members: map[string]bool{},
Permissions: map[string]bool{},
}
}
func CreatePermission(name string) Permission {
return Permission{
UUID: utils.GenerateNewUUID(),
Name: name,
}
}
func CreateUser(username string, mail string, password string) User {
salt := utils.GenerateNewSHA256Sum()
return User{
UUID: utils.GenerateNewUUID(),
Username: username,
Mail: mail,
Salt: salt,
PasswordHash: generatePasswordHash(password, salt),
}
}