Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
45 lines
822 B
Go
45 lines
822 B
Go
package server
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
func (s *Server) handleBindPathAPI(
|
|
w http.ResponseWriter,
|
|
r *http.Request,
|
|
) {
|
|
|
|
var req struct {
|
|
ObjectUUID string `json:"object_uuid"`
|
|
Path string `json:"path"`
|
|
}
|
|
|
|
err := json.NewDecoder(r.Body).Decode(&req)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), 400)
|
|
return
|
|
}
|
|
if s.authorizeObjectForRequest(r, "link", req.ObjectUUID) != nil ||
|
|
s.authorizePathRequest(r, "link", req.Path) != nil ||
|
|
s.authorizePathRequest(r, "create", req.Path) != nil {
|
|
http.Error(w, "forbidden", http.StatusForbidden)
|
|
return
|
|
}
|
|
|
|
err = s.store.BindPathInDomain(
|
|
s.domainUUIDForRequest(r),
|
|
req.Path,
|
|
req.ObjectUUID,
|
|
)
|
|
|
|
if err != nil {
|
|
http.Error(w, err.Error(), 500)
|
|
return
|
|
}
|
|
|
|
_ = json.NewEncoder(w).Encode(map[string]any{
|
|
"status": "ok",
|
|
})
|
|
}
|