Example #1
0
File: admin.go Project: postfix/arx
func newRole(tx *sql.Tx, req *messages.Request, adm *messages.AdminRequest, role string) ([]byte, error) {
	err := db.AddRole(tx, role, adm.Public)
	if err != nil {
		log.Printf("failed to create new role (%v)", err)
		return messages.NewServerResponse(false, "Failed to create role.", nil)
	}
	log.Println("role", role, "created successfully")
	return messages.NewServerResponse(true, "Role created.", nil)
}
Example #2
0
File: admin.go Project: postfix/arx
func initAdmin(tx *sql.Tx, req *messages.Request) ([]byte, error) {
	log.Println("intialising admin role")
	err := db.AddRole(tx, "admin", req.Public)
	if err != nil {
		log.Printf("failed to initialise admin role (%s)", err)
		return messages.NewServerResponse(false, "Failed to initialise admin.", nil)
	}
	log.Println("admin role initialised")
	return messages.NewServerResponse(true, "Admin role initialised.", nil)
}