fix: Event-bus workflow trigger, RBAC on all routes, search provider, events, cron jobs

Critical fixes:
- Event Bus → Workflow auto-trigger: wildcard subscription starts workflows on matching events
- Kommunikation routes: require_permission on all 30+ endpoints (comm:read/write/delete/manage)
- Permissions routes: require_permission('permissions:admin') on all management endpoints
- CompanySearchProvider registered in auto_register_providers()

Medium fixes:
- system_notif events: 10 event_bus.publish() calls added (lead.created, contact.created/updated,
  task.created/overdue, mail.received, user.created, workflow.completed, notification.created, backup.*)
- Cron jobs: backup_check (daily), search_index_check (daily), workflow_timeout (5min) registered
- AI tool permission: call_crm_api now requires 'ai:write' permission
- New file: automation/jobs.py with backup_check and search_index_check functions
This commit is contained in:
Agent Zero
2026-07-25 03:22:55 +02:00
parent b01c798739
commit 6e7e39d101
14 changed files with 266 additions and 22 deletions
+12
View File
@@ -106,6 +106,18 @@ async def create_task(
)
db.add(task)
await db.flush()
# Publish task.created event
from app.core.event_bus import get_event_bus
event_bus = get_event_bus()
await event_bus.publish('task.created', {
'task_id': str(task.id),
'tenant_id': str(tenant_id),
'user_id': str(user_id),
'title': task.title,
'assigned_to': str(task.assigned_to) if task.assigned_to else None,
})
return _task_to_dict(task)