diff --git a/models/models.go b/models/models.go index bd19790..4f47db6 100644 --- a/models/models.go +++ b/models/models.go @@ -61,6 +61,8 @@ func SetEngine() (err error) { // If it doesn't exist, create it if !exists { + Config.FirstUser.IsAdmin = true // Make the first user admin + _, err = CreateUser(Config.FirstUser) if err != nil { // Janky hack, I know diff --git a/models/user.go b/models/user.go index 15ecbc1..1c9b32f 100644 --- a/models/user.go +++ b/models/user.go @@ -20,6 +20,7 @@ type User struct { Username string `xorm:"varchar(250) not null unique"` Password string `xorm:"varchar(250) not null"` Email string `xorm:"varchar(250)"` + IsAdmin bool `xorm:"tinyint(1) not null"` Created int64 `xorm:"created"` Updated int64 `xorm:"updated"` }