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)
| 4080 | // commitment write door (requireCommitmentWrite) shares it, so both refuse |
| 4081 | // identically. |
| 4082 | func (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. |
no test coverage detected