fix(collections): add authentication check to PreviewCollection handler
The PreviewCollection endpoint was missing authentication verification, allowing unauthenticated access to the preview functionality. Added check for user in context, returning 401 Unauthorized if missing.
This commit is contained in:
@@ -827,6 +827,11 @@ func (h *CollectionHandler) HandleBulkAddBooks(c echo.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *CollectionHandler) PreviewCollection(c echo.Context) error {
|
func (h *CollectionHandler) PreviewCollection(c echo.Context) error {
|
||||||
|
user := c.Get("user")
|
||||||
|
if user == nil {
|
||||||
|
return c.JSON(http.StatusUnauthorized, map[string]string{"error": "unauthorized"})
|
||||||
|
}
|
||||||
|
|
||||||
var req struct {
|
var req struct {
|
||||||
LibraryID string `json:"library_id"`
|
LibraryID string `json:"library_id"`
|
||||||
Rules []services.Rule `json:"rules"`
|
Rules []services.Rule `json:"rules"`
|
||||||
|
|||||||
Reference in New Issue
Block a user