Simplify tables

This commit is contained in:
Philipp Heckel
2022-01-22 23:01:20 -05:00
parent 86b20e8ccd
commit 1287594505
6 changed files with 217 additions and 208 deletions

28
server/auth.go Normal file
View File

@@ -0,0 +1,28 @@
package server
// auth is a generic interface to implement password-based authentication and authorization
type auth interface {
Authenticate(user, pass string) (*user, error)
Authorize(user *user, topic string, perm int) error
}
type user struct {
Name string
Role string
}
const (
permRead = 1
permWrite = 2
)
const (
roleAdmin = "admin"
roleUser = "user"
roleNone = "none"
)
var everyone = &user{
Name: "",
Role: roleNone,
}