New enterprise feature
This commit is contained in:
@@ -98,7 +98,10 @@ async def get_user_notifications_enhanced(
|
||||
"""Get notifications for a user with enhanced filtering"""
|
||||
|
||||
# Users can only get their own notifications unless they're admin
|
||||
if user_id != current_user["user_id"] and current_user.get("role") not in ["admin", "manager"]:
|
||||
# Handle demo user ID mismatch: frontend uses "demo-user" but token has "demo-user-{session-id}"
|
||||
is_demo_user = current_user["user_id"].startswith("demo-user-") and user_id == "demo-user"
|
||||
|
||||
if user_id != current_user["user_id"] and not is_demo_user and current_user.get("role") not in ["admin", "manager"]:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="Can only access your own notifications"
|
||||
|
||||
Reference in New Issue
Block a user