Restore compute_user_tier compatibility wrapper
This commit is contained in:
parent
645cc91496
commit
cb801ca1dc
1 changed files with 3 additions and 0 deletions
|
|
@ -5,6 +5,9 @@ TIER_LEVELS = {"visitor": 0, "citizen": 1, "moderation": 2, "charcoal": 3, "guar
|
||||||
def evaluate_member_access(role_ids: list) -> dict:
|
def evaluate_member_access(role_ids: list) -> dict:
|
||||||
return evaluate_web_access(role_ids)
|
return evaluate_web_access(role_ids)
|
||||||
|
|
||||||
|
def compute_user_tier(role_ids: list, role_tiers: dict = None) -> str:
|
||||||
|
return evaluate_web_access(role_ids).get("tier", "visitor")
|
||||||
|
|
||||||
def filter_tools_for_tier(tools: list, user_tier: str) -> list:
|
def filter_tools_for_tier(tools: list, user_tier: str) -> list:
|
||||||
user_lvl = TIER_LEVELS.get(user_tier, 0)
|
user_lvl = TIER_LEVELS.get(user_tier, 0)
|
||||||
return [{**t, "unlocked": user_lvl >= TIER_LEVELS.get(t.get("min_tier", "visitor"), 0)} for t in tools]
|
return [{**t, "unlocked": user_lvl >= TIER_LEVELS.get(t.get("min_tier", "visitor"), 0)} for t in tools]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue