Tiered LDAP groups

This commit is contained in:
2026-10-29 14:17:16 -04:00
parent 0bffd7d993
commit 920a608fba
10 changed files with 565 additions and 8 deletions
+10
View File
@@ -141,3 +141,13 @@ for key, tier in MEMBERSHIP_TIERS.items():
raise ValueError
except (InvalidOperation, ValueError, TypeError):
raise ImproperlyConfigured(f"Tier {key} usd_amount must be a positive USD amount with at most two decimals.") from None
# Separate from Stripe tiers so free accounts can receive service benefits too.
from members.service_groups import validate_service_groups
service_groups_file = os.environ.get("MEMBERSHIP_SERVICE_GROUPS_FILE", "")
try:
service_groups = json.loads(os.environ["MEMBERSHIP_SERVICE_GROUPS_JSON"]) if "MEMBERSHIP_SERVICE_GROUPS_JSON" in os.environ else json.loads(Path(service_groups_file).read_text(encoding="utf-8")) if service_groups_file else {}
except (ValueError, OSError):
raise ImproperlyConfigured("Cannot load membership service group configuration.") from None
MEMBERSHIP_SERVICE_GROUPS = validate_service_groups(service_groups, levels)