MCPcopy Create free account
hub / github.com/netlify/gotrue / adminAuditLog

Method adminAuditLog

api/audit.go:16–47  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

14}
15
16func (a *API) adminAuditLog(w http.ResponseWriter, r *http.Request) error {
17 ctx := r.Context()
18 instanceID := getInstanceID(ctx)
19 // aud := a.requestAud(ctx, r)
20
21 pageParams, err := paginate(r)
22 if err != nil {
23 return badRequestError("Bad Pagination Parameters: %v", err)
24 }
25
26 var col []string
27 var qval string
28 q := r.URL.Query().Get("query")
29 if q != "" {
30 var exists bool
31 qparts := strings.SplitN(q, ":", 2)
32 col, exists = filterColumnMap[qparts[0]]
33 if !exists || len(qparts) < 2 {
34 return badRequestError("Invalid query scope: %s", q)
35 }
36 qval = qparts[1]
37 }
38
39 logs, err := models.FindAuditLogEntries(a.db, instanceID, col, qval, pageParams)
40 if err != nil {
41 return internalServerError("Error searching for audit logs").WithInternalError(err)
42 }
43
44 addPaginationHeaders(w, r, pageParams)
45
46 return sendJSON(w, http.StatusOK, logs)
47}

Callers

nothing calls this directly

Calls 9

FindAuditLogEntriesFunction · 0.92
getInstanceIDFunction · 0.85
paginateFunction · 0.85
badRequestErrorFunction · 0.85
internalServerErrorFunction · 0.85
addPaginationHeadersFunction · 0.85
sendJSONFunction · 0.85
GetMethod · 0.80
WithInternalErrorMethod · 0.45

Tested by

no test coverage detected