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

Method requireCollectionFullyVisible

internal/server/server.go:2089–2100  ·  view source on GitHub ↗

requireCollectionFullyVisible checks that the collection is visible to the requesting user under FULL-collection-access semantics (BUG-1920 — codex R2 follow-up). This is deliberately STRICTER than handleGetCollection's inline visibleCollectionIDs + isCollectionVisible check: VisibleCollectionIDs (w

(w http.ResponseWriter, r *http.Request, workspaceID string, coll *models.Collection)

Source from the content-addressed store, hash-verified

2087// Writes a 404 and returns false if not visible; callers should invoke this
2088// immediately after resolving a collection by slug/ID.
2089func (s *Server) requireCollectionFullyVisible(w http.ResponseWriter, r *http.Request, workspaceID string, coll *models.Collection) bool {
2090 visible, err := s.checkCollectionFullyVisible(r, workspaceID, coll.ID)
2091 if err != nil {
2092 writeInternalError(w, err)
2093 return false
2094 }
2095 if !visible {
2096 writeError(w, http.StatusNotFound, "not_found", "Collection not found")
2097 return false
2098 }
2099 return true
2100}
2101
2102// requireItemVisible checks that the item's collection is visible to the
2103// requesting user. For guests with item-level grants, also verifies that the

Calls 3

writeInternalErrorFunction · 0.85
writeErrorFunction · 0.85

Tested by

no test coverage detected