all repos — flounder @ 419c92fa3571df38efab35b01e3b8b23d5e4559e

A small site builder for the Gemini protocol

add make admin command
alex wennerberg alex@alexwennerberg.com
Sat, 31 Oct 2020 12:40:49 -0700
commit

419c92fa3571df38efab35b01e3b8b23d5e4559e

parent

3384eb4f1e94daa548dadcd5d074d59edc0c7eb0

1 files changed, 12 insertions(+), 0 deletions(-)

jump to
M admin.goadmin.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 {