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