func Admin(d db.DB) API { return func(r *htr.Router) error { if err := db.SetupBuckets(d, admin.Buckets()); err != nil { return err } r.GET("/admin/valid", handleAdminValid(d)) r.GET("/admin/create", handleAdminCreate(d)) r.GET("/admin/delete", handleAdminDelete(d)) return nil } }
func (s *AdminSuite) SetUpTest(c *gc.C) { d, err := t.NewDB( t.SetupBolt("test.db"), t.SetupBuckets(admin.Buckets()), ) c.Assert(err, jc.ErrorIsNil) s.d = d s.admins = map[string]t.TestAdmin{ "bob": { Email: "*****@*****.**", Pwhash: "12345", }, "larry": { Email: "*****@*****.**", Pwhash: "54321", }, } }
func AdminCLI(d db.DB) cli.Binding { return func(c *cli.CLI) error { if err := db.SetupBuckets(d, admin.Buckets()); err != nil { return err } return c.AddCommands(&cli.Command{ Name: "create", Description: "create a new admin", Aliases: []string{"c", "admin", "new"}, Fn: cliCreate(c, d), }, &cli.Command{ Name: "delete", Description: "delete an admin by email", Aliases: []string{"d", "kill"}, Fn: cliDelete(d), }) } }