Beispiel #1
0
func adminId(w http.ResponseWriter, r *http.Request, c *webc.Context) {
	c.CheckAuth(w, r, "admin", "/")
	fmt.Fprintf(w, "user id: %v", c.GetPathVar("id"))
}
Beispiel #2
0
func admin(w http.ResponseWriter, r *http.Request, c *webc.Context) {
	c.CheckAuth(w, r, "admin", "/")
	fmt.Fprintf(w, "page: user, addr: %s, user-agent: %s", r.RemoteAddr, r.UserAgent())
	return
}
Beispiel #3
0
func adminAdd(w http.ResponseWriter, r *http.Request, c *webc.Context) {
	c.CheckAuth(w, r, "admin", "/")
	fmt.Fprintf(w, "User Add Page")
}
Beispiel #4
0
func protected(w http.ResponseWriter, r *http.Request, c *webc.Context) {
	slug := c.GetPathVar("slug")
	c.CheckAuth(w, r, "driver", "/"+slug)
	fmt.Fprintf(w, "You are authorized to view page %s", slug)
}