MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / writeEditRefusal

Method writeEditRefusal

internal/server/server.go:4082–4094  ·  view source on GitHub ↗

writeEditRefusal writes requireEditPermission's refusal bytes. The commitment write door (requireCommitmentWrite) shares it, so both refuse identically.

(w http.ResponseWriter, r *http.Request, collectionID string)

Source from the content-addressed store, hash-verified

4080// commitment write door (requireCommitmentWrite) shares it, so both refuse
4081// identically.
4082func (s *Server) writeEditRefusal(w http.ResponseWriter, r *http.Request, collectionID string) {
4083 if !appWriteAllows(r, collectionID) {
4084 writeError(w, http.StatusForbidden, "forbidden", "This app may not write here")
4085 return
4086 }
4087 // An editor or owner refused here is outside their collection access,
4088 // and a guest holds grants, not a role: neither is fixed by a role change.
4089 reason := roleGateReason(r)
4090 if requireRole(r, "editor") {
4091 reason = forbiddenReasonNoAccess
4092 }
4093 writeForbidden(w, "forbidden", "Insufficient permissions", reason)
4094}
4095
4096// canEditInCollection is requireEditPermission's decision without the
4097// response, for callers that report per row (bulk) rather than per request.

Callers 2

requireEditPermissionMethod · 0.95

Calls 5

appWriteAllowsFunction · 0.85
writeErrorFunction · 0.85
roleGateReasonFunction · 0.85
requireRoleFunction · 0.85
writeForbiddenFunction · 0.85

Tested by

no test coverage detected