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

Method requireCollectionFullyVisible

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

1989// Writes a 404 and returns false if not visible; callers should invoke this
1990// immediately after resolving a collection by slug/ID.
1991func (s *Server) requireCollectionFullyVisible(w http.ResponseWriter, r *http.Request, workspaceID string, coll *models.Collection) bool {
1992 visible, err := s.checkCollectionFullyVisible(r, workspaceID, coll.ID)
1993 if err != nil {
1994 writeInternalError(w, err)
1995 return false
1996 }
1997 if !visible {
1998 writeError(w, http.StatusNotFound, "not_found", "Collection not found")
1999 return false
2000 }
2001 return true
2002}
2003
2004// requireItemVisible checks that the item's collection is visible to the
2005// 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