diff --git a/packages/server/src/notify_bridge_server/api/command_trackers.py b/packages/server/src/notify_bridge_server/api/command_trackers.py index 262c60b..408b825 100644 --- a/packages/server/src/notify_bridge_server/api/command_trackers.py +++ b/packages/server/src/notify_bridge_server/api/command_trackers.py @@ -72,9 +72,9 @@ async def create_command_tracker( if not provider or provider.user_id != user.id: raise HTTPException(status_code=404, detail="Provider not found") - # Validate command config exists and user owns it + # Validate command config exists and is accessible (owned or system-shared) config = await session.get(CommandConfig, body.command_config_id) - if not config or config.user_id != user.id: + if not config or config.user_id not in (user.id, 0): raise HTTPException(status_code=404, detail="Command config not found") # Validate provider_type matches @@ -119,10 +119,10 @@ async def update_command_tracker( updates = body.model_dump(exclude_unset=True) - # If changing command_config_id, validate ownership and provider_type match + # If changing command_config_id, validate accessibility and provider_type match if "command_config_id" in updates and updates["command_config_id"] is not None: config = await session.get(CommandConfig, updates["command_config_id"]) - if not config or config.user_id != user.id: + if not config or config.user_id not in (user.id, 0): raise HTTPException(status_code=404, detail="Command config not found") provider = await session.get(ServiceProvider, tracker.provider_id) if provider and config.provider_type != provider.type: