package auth // User represents a logged-in user of the website or app. type User struct { ID string `json:"id"` Level string `json:"level"` Data map[string]string `json:"data"` Session *Session `json:"-"` method Authenticator loggedOut bool } // FullID is the userid prefixed with the method ID func (user *User) FullID() string { return user.method.ID() + ":" + user.ID } // Logout flags the user for logout func (user *User) Logout() { user.loggedOut = true } // LoggedOut returns whether the Logout() function has been called func (user *User) LoggedOut() bool { return user.loggedOut } // NewUser creates a new User object func NewUser(method Authenticator, id, level string, data map[string]string) *User { return &User{id, level, data, nil, method, false} }