MCPcopy Create free account
hub / github.com/crewjam/saml / HandleListUsers

Method HandleListUsers

samlidp/user.go:28–39  ·  view source on GitHub ↗

HandleListUsers handles the `GET /users/` request and responds with a JSON formatted list of user names.

(c web.C, w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

26// HandleListUsers handles the `GET /users/` request and responds with a JSON formatted list
27// of user names.
28func (s *Server) HandleListUsers(c web.C, w http.ResponseWriter, r *http.Request) {
29 users, err := s.Store.List("/users/")
30 if err != nil {
31 s.logger.Printf("ERROR: %s", err)
32 http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
33 return
34 }
35
36 json.NewEncoder(w).Encode(struct {
37 Users []string `json:"users"`
38 }{Users: users})
39}
40
41// HandleGetUser handles the `GET /users/:id` request and responds with the user object in JSON
42// format. The HashedPassword field is excluded.

Callers

nothing calls this directly

Calls 4

PrintfMethod · 0.80
ListMethod · 0.65
EncodeMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected