42 lines
789 B
Go
42 lines
789 B
Go
package user
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
const (
|
|
ROLE_ADMIN = "admin"
|
|
ROLE_GAMEMASTER = "gamemaster"
|
|
ROLE_PLAYER = "player"
|
|
ROLE_SETUP = "setup"
|
|
)
|
|
|
|
type User struct {
|
|
mu sync.Mutex
|
|
id string
|
|
filename string
|
|
authcode string
|
|
name string
|
|
role string
|
|
gameId string
|
|
created int64
|
|
lastLoggedIn int64
|
|
cameo *User
|
|
}
|
|
|
|
type UserJson struct {
|
|
Authcode string `json:"authcode"`
|
|
Name string `json:"name"`
|
|
Role string `json:"role"`
|
|
GameId string `json:"game"`
|
|
Created int64 `json:"created"`
|
|
LastLoggedIn int64 `json:"lastLoggedIn"`
|
|
}
|
|
|
|
type UserinfoJson struct {
|
|
Name string `json:"name"`
|
|
Role string `json:"role"`
|
|
GameId string `json:"game"`
|
|
IsCameo bool `json:"-"`
|
|
}
|