feat(admin): add is_admin() access guard
Implement access control function for admin panel. Returns True only if ADMIN_EMAIL env var is set, user is authenticated, and email matches case-insensitively. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import os
|
||||
|
||||
from flask_login import current_user
|
||||
|
||||
|
||||
def is_admin() -> bool:
|
||||
admin_email = os.getenv("ADMIN_EMAIL")
|
||||
return bool(
|
||||
admin_email
|
||||
and current_user.is_authenticated
|
||||
and current_user.email.lower() == admin_email.lower()
|
||||
)
|
||||
Reference in New Issue
Block a user