Basic provisioning api

Includes: login, logout, and ping.
This commit is contained in:
Gary Kramlich
2022-02-21 06:49:44 -06:00
parent a51b1074ba
commit d883befee5
10 changed files with 429 additions and 6 deletions

View File

@@ -37,6 +37,21 @@ func (u *User) NewSession(token string) error {
return nil
}
// DeleteSession tries to logout and delete the session from the database.
func (u *User) DeleteSession() error {
err := u.Session.Close()
if err != nil {
u.log.Warnfln("failed to close the session for %s: %v", u.ID, err)
}
u.Session = nil
u.Update()
return nil
}
func (u *User) Scan(row Scannable) *User {
var token sql.NullString