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

Method requireCollectionFullyVisible

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

2044// Writes a 404 and returns false if not visible; callers should invoke this
2045// immediately after resolving a collection by slug/ID.
2046func (s *Server) requireCollectionFullyVisible(w http.ResponseWriter, r *http.Request, workspaceID string, coll *models.Collection) bool {
2047 visible, err := s.checkCollectionFullyVisible(r, workspaceID, coll.ID)
2048 if err != nil {
2049 writeInternalError(w, err)
2050 return false
2051 }
2052 if !visible {
2053 writeError(w, http.StatusNotFound, "not_found", "Collection not found")
2054 return false
2055 }
2056 return true
2057}
2058
2059// requireItemVisible checks that the item's collection is visible to the
2060// 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