From 29e5284ead1a0c181e424193a26fd67157cd24d0 Mon Sep 17 00:00:00 2001 From: "Eugene M." Date: Wed, 22 Apr 2026 08:59:15 -0400 Subject: [PATCH] ENH: TagBasedAccessPolicy accepts list of providers Allow configuring multiple identity providers in TagBasedAccessPolicy by accepting either a single string or a list of strings for the provider parameter. --- CHANGELOG.md | 4 +++- tiled/access_control/access_policies.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a36e0f1c..e485539d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,9 @@ Write the date in place of the "Unreleased" in the case a new version is release ### Added -- Tests for the WebSocket endpoints that stream tabukar data. +- Tests for the WebSocket endpoints that stream tabular data. +- `TagBasedAccessPolicy` now accepts a list of providers in addition to a + single provider string. ## v0.2.7 (2026-02-27) diff --git a/tiled/access_control/access_policies.py b/tiled/access_control/access_policies.py index ee8021c3e..ea22db8b4 100644 --- a/tiled/access_control/access_policies.py +++ b/tiled/access_control/access_policies.py @@ -72,7 +72,7 @@ def __init__( access_tags_parser, scopes=None, ): - self.provider = provider + self.providers = [provider] if isinstance(provider, str) else list(provider) self.scopes = scopes if (scopes is not None) else ALL_SCOPES access_tags_parser = import_object(access_tags_parser) @@ -92,11 +92,11 @@ def __init__( def _get_id(self, principal): for identity in principal.identities: - if identity.provider == self.provider: + if identity.provider in self.providers: return identity.id else: raise ValueError( - f"Principal {principal} has no identity from provider {self.provider}." + f"Principal {principal} has no identity from providers {self.providers}." f"The Principal's identities are: {principal.identities}" )