mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-02 01:51:14 +03:00
filter alertCameras by allowed cameras so the recent alerts query for restricted roles doesn't reference cameras they can't access
This commit is contained in:
parent
8368f22784
commit
e9bc79d3b3
@ -13,6 +13,7 @@ import {
|
|||||||
TooltipProvider,
|
TooltipProvider,
|
||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
|
import { useAllowedCameras } from "@/hooks/use-allowed-cameras";
|
||||||
import { useUserPersistence } from "@/hooks/use-user-persistence";
|
import { useUserPersistence } from "@/hooks/use-user-persistence";
|
||||||
import {
|
import {
|
||||||
AllGroupsStreamingSettings,
|
AllGroupsStreamingSettings,
|
||||||
@ -90,6 +91,7 @@ export default function LiveDashboardView({
|
|||||||
// recent events
|
// recent events
|
||||||
|
|
||||||
const eventUpdate = useFrigateReviews();
|
const eventUpdate = useFrigateReviews();
|
||||||
|
const allowedCameras = useAllowedCameras();
|
||||||
|
|
||||||
const alertCameras = useMemo(() => {
|
const alertCameras = useMemo(() => {
|
||||||
if (!config) {
|
if (!config) {
|
||||||
@ -98,14 +100,16 @@ export default function LiveDashboardView({
|
|||||||
|
|
||||||
if (cameraGroup == "default") {
|
if (cameraGroup == "default") {
|
||||||
return Object.values(config.cameras)
|
return Object.values(config.cameras)
|
||||||
.filter((cam) => cam.ui.dashboard)
|
.filter((cam) => cam.ui.dashboard && allowedCameras.includes(cam.name))
|
||||||
.map((cam) => cam.name)
|
.map((cam) => cam.name)
|
||||||
.join(",");
|
.join(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeBirdseye && cameras.length == 0) {
|
if (includeBirdseye && cameras.length == 0) {
|
||||||
return Object.values(config.cameras)
|
return Object.values(config.cameras)
|
||||||
.filter((cam) => cam.birdseye.enabled)
|
.filter(
|
||||||
|
(cam) => cam.birdseye.enabled && allowedCameras.includes(cam.name),
|
||||||
|
)
|
||||||
.map((cam) => cam.name)
|
.map((cam) => cam.name)
|
||||||
.join(",");
|
.join(",");
|
||||||
}
|
}
|
||||||
@ -114,7 +118,7 @@ export default function LiveDashboardView({
|
|||||||
.map((cam) => cam.name)
|
.map((cam) => cam.name)
|
||||||
.filter((cam) => config.camera_groups[cameraGroup]?.cameras.includes(cam))
|
.filter((cam) => config.camera_groups[cameraGroup]?.cameras.includes(cam))
|
||||||
.join(",");
|
.join(",");
|
||||||
}, [cameras, cameraGroup, config, includeBirdseye]);
|
}, [cameras, cameraGroup, config, includeBirdseye, allowedCameras]);
|
||||||
|
|
||||||
const { data: allEvents, mutate: updateEvents } = useSWR<ReviewSegment[]>([
|
const { data: allEvents, mutate: updateEvents } = useSWR<ReviewSegment[]>([
|
||||||
"review",
|
"review",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user