add make admin command
alex wennerberg alex@alexwennerberg.com
Sat, 31 Oct 2020 12:40:49 -0700
1 files changed,
12 insertions(+),
0 deletions(-)
jump to
M
admin.go
→
admin.go
@@ -31,9 +31,21 @@ username := os.Args[3]
// TODO add confirmation err := deleteUser(username) log.Fatal(err) + case "make-admin": + username := os.Args[3] + err := makeAdmin(username) + log.Fatal(err) } // reset password +} + +func makeAdmin(username string) error { + _, err := DB.Exec("UPDATE user SET admin = true WHERE username = $1", username) + if err != nil { + return err + } + return nil } func activateUser(username string) error {