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

Method writeEditRefusal

internal/server/server.go:4140–4152  ·  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

4138// commitment write door (requireCommitmentWrite) shares it, so both refuse
4139// identically.
4140func (s *Server) writeEditRefusal(w http.ResponseWriter, r *http.Request, collectionID string) {
4141 if !appWriteAllows(r, collectionID) {
4142 writeError(w, http.StatusForbidden, "forbidden", "This app may not write here")
4143 return
4144 }
4145 // An editor or owner refused here is outside their collection access,
4146 // and a guest holds grants, not a role: neither is fixed by a role change.
4147 reason := roleGateReason(r)
4148 if requireRole(r, "editor") {
4149 reason = forbiddenReasonNoAccess
4150 }
4151 writeForbidden(w, "forbidden", "Insufficient permissions", reason)
4152}
4153
4154// canEditInCollection is requireEditPermission's decision without the
4155// response, for callers that report per row (bulk) rather than per request.

Callers 3

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