import jingrow
from jingrow.core.pagetype.user.user import User


def is_system_manager(user: str | None = None) -> bool:
	"""
	Checks if the given user is a system manager.

	:param user: User to check. If None, uses the current session user.
	:return: True if the user is a system manager, False otherwise.
	"""
	user = user or jingrow.session.user
	user_pg: User = jingrow.get_cached_pg("User", user)
	return bool(user_pg.get("roles", {"role": "System Manager"}))
