mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 11:57:51 +01:00
feat: also consider OAUTH_ROLES_SEPARATOR for string claims themselves (#19514)
This commit is contained in:
@@ -583,14 +583,16 @@ OAUTH_ROLES_CLAIM = PersistentConfig(
|
||||
os.environ.get("OAUTH_ROLES_CLAIM", "roles"),
|
||||
)
|
||||
|
||||
SEP = os.environ.get("OAUTH_ROLES_SEPARATOR", ",")
|
||||
OAUTH_ROLES_SEPARATOR = os.environ.get("OAUTH_ROLES_SEPARATOR", ",")
|
||||
|
||||
OAUTH_ALLOWED_ROLES = PersistentConfig(
|
||||
"OAUTH_ALLOWED_ROLES",
|
||||
"oauth.allowed_roles",
|
||||
[
|
||||
role.strip()
|
||||
for role in os.environ.get("OAUTH_ALLOWED_ROLES", f"user{SEP}admin").split(SEP)
|
||||
for role in os.environ.get(
|
||||
"OAUTH_ALLOWED_ROLES", f"user{OAUTH_ROLES_SEPARATOR}admin"
|
||||
).split(OAUTH_ROLES_SEPARATOR)
|
||||
if role
|
||||
],
|
||||
)
|
||||
@@ -600,7 +602,9 @@ OAUTH_ADMIN_ROLES = PersistentConfig(
|
||||
"oauth.admin_roles",
|
||||
[
|
||||
role.strip()
|
||||
for role in os.environ.get("OAUTH_ADMIN_ROLES", "admin").split(SEP)
|
||||
for role in os.environ.get("OAUTH_ADMIN_ROLES", "admin").split(
|
||||
OAUTH_ROLES_SEPARATOR
|
||||
)
|
||||
if role
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user