Library Panels: Return valid panels (#109827)

This commit is contained in:
Ezequiel Victorero
2025-08-19 11:44:27 -03:00
committed by GitHub
parent b0e9307d15
commit a3396e3549
2 changed files with 179 additions and 1 deletions
+4 -1
View File
@@ -382,7 +382,10 @@ func (l *LibraryElementService) filterLibraryPanelsByPermission(c *contextmodel.
for _, p := range elements {
allowed, err := l.AccessControl.Evaluate(c.Req.Context(), c.SignedInUser, ac.EvalPermission(ActionLibraryPanelsRead, ScopeLibraryPanelsProvider.GetResourceScopeUID(p.UID)))
if err != nil {
return nil, err
// This could fail because the folder that contains the library panel does not exist or the user doesn't have permissions to read it.
// We skip it instead of breaking the library panel list rendering flow and log the error.
l.log.Warn("Failed to evaluate permissions", "error", err)
continue
}
if allowed {
filteredPanels = append(filteredPanels, p)