Add user management interface

This commit is contained in:
Las Zenow 2018-04-08 10:55:13 +00:00
parent 6cd5b1bc5e
commit 6f906ccae4
8 changed files with 124 additions and 8 deletions

View file

@ -21,7 +21,9 @@ type DB interface {
AddRawUser(name string, hpass []byte, salt []byte, role string) error
GetRole(name string) (string, error)
SetPassword(name string, pass string) error
SetRole(name, role string) error
ValidPassword(name string, pass string) bool
ListUsers() ([]User, error)
AddNews(text string) error
AddRawNews(text string, date time.Time) error
GetNews(num int, days int) (news []New, err error)
@ -94,7 +96,7 @@ func (db pgDB) Close() error {
}
func (db pgDB) create() error {
models := []interface{}{&Book{}, &New{}, &user{}, &Visit{}, &Submission{}}
models := []interface{}{&Book{}, &New{}, &User{}, &Visit{}, &Submission{}}
for _, model := range models {
options := &orm.CreateTableOptions{
IfNotExists: true,