mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-12-03 02:37:06 +03:00
Add a deny option for the proxy default role (#24145)
* backend * frontend * docs * fix none default role casing and name reserved roles in the error * reserve every casing of none as a role name
This commit is contained in:
committed by
Nicolas Mowen
parent
41bc1a5844
commit
e2da7aae99
+11
-1
@@ -43,7 +43,7 @@ class ProxyConfig(FrigateBaseModel):
|
||||
default_role: str | None = Field(
|
||||
default="viewer",
|
||||
title="Default role",
|
||||
description="Default role assigned to proxy-authenticated users when no role mapping applies.",
|
||||
description="Default role assigned to proxy-authenticated users when no role mapping applies. Set to 'none' to deny access to unmapped users.",
|
||||
)
|
||||
separator: str | None = Field(
|
||||
default=",",
|
||||
@@ -51,6 +51,16 @@ class ProxyConfig(FrigateBaseModel):
|
||||
description="Character used to split multiple values provided in proxy headers.",
|
||||
)
|
||||
|
||||
@field_validator("default_role", mode="before")
|
||||
@classmethod
|
||||
def normalize_deny_sentinel(cls, v):
|
||||
# Fail closed on capitalization: an unnormalized "None" would miss the
|
||||
# sentinel and fall back to viewer, granting the access it was meant to
|
||||
# deny. Other role names stay case-sensitive.
|
||||
if isinstance(v, str) and v.strip().lower() == "none":
|
||||
return "none"
|
||||
return v
|
||||
|
||||
@field_validator("separator", mode="before")
|
||||
@classmethod
|
||||
def validate_separator_length(cls, v):
|
||||
|
||||
Reference in New Issue
Block a user