manager

package
v0.0.0-...-27d6564 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2015 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const API_PREFIX = "/api"

Variables

View Source
var AuthWhiteList = map[string][]string{
	"GET":    {"/_ping"},
	"POST":   {"/login"},
	"DELETE": {},
}

Functions

This section is empty.

Types

type Admin

type Admin struct {
	Id       int
	Name     string
	Password string
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func New

func New(addr string, db *sql.DB, ch chan<- error) (*Manager, error)

func (*Manager) AddUser

func (mgr *Manager) AddUser(w http.ResponseWriter, r *http.Request, rnd render.Render)

POST /api/users

func (*Manager) ChPasswd

func (mgr *Manager) ChPasswd(w http.ResponseWriter, r *http.Request, ss sessions.Session)

GET /api/containers

func (*Manager) Containers

func (mgr *Manager) Containers(w http.ResponseWriter, rnd render.Render)

GET /api/containers

func (*Manager) CreateContainer

func (mgr *Manager) CreateContainer(w http.ResponseWriter, r *http.Request)

POST /api/containers

func (*Manager) DeleteContainer

func (mgr *Manager) DeleteContainer(w http.ResponseWriter, r *http.Request, params martini.Params, rnd render.Render)

DELETE /api/containers/:id

func (*Manager) DeleteUser

func (mgr *Manager) DeleteUser(w http.ResponseWriter, params martini.Params)

DELETE /api/users/:id

func (*Manager) Grant

func (mgr *Manager) Grant(w http.ResponseWriter, r *http.Request)

POST /api/priv?user_id=123&container=dev1

func (*Manager) InitMartini

func (mgr *Manager) InitMartini() error

func (*Manager) Login

func (mgr *Manager) Login(w http.ResponseWriter, r *http.Request, ss sessions.Session)

POST /api/login

func (*Manager) Logout

func (mgr *Manager) Logout(w http.ResponseWriter, r *http.Request, ss sessions.Session)

DELETE /api/logout

func (*Manager) Revoke

func (mgr *Manager) Revoke(w http.ResponseWriter, params martini.Params)

DELETE /api/priv/:id

func (*Manager) Start

func (mgr *Manager) Start()

func (*Manager) Users

func (mgr *Manager) Users(w http.ResponseWriter, rnd render.Render)

GET /api/users

type Priv

type Priv struct {
	PrivId   int       `json:"priv_id"`
	Cid      string    `json:"cid"`
	UserId   int       `json:"user_id"`
	JoinedAt time.Time `json:"joined_at"`
}

User to Container privileges map

type User

type User struct {
	Id        int       `json:"id,omitempty"`
	Name      string    `json:"user_name"`
	CreatedAt time.Time `json:"user_created_at"`
}

type UserPriv

type UserPriv struct {
	User
	Priv
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL