List of users for admin, build script, update dump

This commit is contained in:
Aurélie Delhaie
2022-05-29 23:05:06 +02:00
parent 7a8672ce80
commit 7b4d9ee83f
7 changed files with 106 additions and 7 deletions

View File

@@ -64,6 +64,27 @@ func unauthorized(w http.ResponseWriter, r *http.Request) {
}
}
func forbidden(w http.ResponseWriter, r *http.Request) {
e := httpError{
Status: 403,
Error: "Unauthorized",
Message: "The access is permanently forbidden and tied to the application logic, such as insufficient rights to a resource.",
Path: r.RequestURI,
Timestamp: time.Now(),
}
payload, err := json.Marshal(e)
if err != nil {
log.Println(err)
}
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(403)
_, err = w.Write(payload)
if err != nil {
log.Println(err)
}
}
func ok(obj interface{}, w http.ResponseWriter, _ *http.Request) {
payload, err := json.Marshal(obj)
if err != nil {