14 lines
411 B
Python
14 lines
411 B
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Iterable
|
|
|
|
ADMIN_ROLES: frozenset[str] = frozenset({"super_admin", "admin", "finance_admin"})
|
|
|
|
|
|
def has_admin_role(roles: Iterable[str] | None) -> bool:
|
|
"""Return True if any assigned role grants administrative privileges."""
|
|
if not roles:
|
|
return False
|
|
return any((role or "").strip().lower() in ADMIN_ROLES for role in roles)
|
|
|