(entitlements) add Entitlements backend with Deploy Center support (#31)

This checks if the user has access to the app and can create calendars.
This commit is contained in:
Sylvain Zimmer
2026-03-06 02:47:03 +01:00
committed by GitHub
parent 5e0506d64b
commit cd2b15b3b5
26 changed files with 1312 additions and 120 deletions

View File

@@ -0,0 +1,27 @@
"""Abstract base class for entitlements backends."""
from abc import ABC, abstractmethod
class EntitlementsBackend(ABC):
"""Abstract base class that defines the interface for entitlements backends."""
@abstractmethod
def get_user_entitlements(
self, user_sub, user_email, user_info=None, force_refresh=False
):
"""Fetch user entitlements.
Args:
user_sub: The user's OIDC subject identifier.
user_email: The user's email address.
user_info: The full OIDC user_info dict (backends may
extract claims from it).
force_refresh: If True, bypass any cache and fetch fresh data.
Returns:
dict: {"can_access": bool}
Raises:
EntitlementsUnavailableError: If the backend cannot be reached.
"""