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:
@@ -810,6 +810,18 @@ async def imap_sync_folder(
|
||||
await db.flush()
|
||||
synced_count += 1
|
||||
|
||||
# Publish mail.received event
|
||||
from app.core.event_bus import get_event_bus
|
||||
event_bus = get_event_bus()
|
||||
await event_bus.publish('mail.received', {
|
||||
'mail_id': str(mail.id),
|
||||
'tenant_id': str(tenant_id),
|
||||
'account_id': str(account.id),
|
||||
'folder_id': str(folder.id),
|
||||
'subject': subject,
|
||||
'from_address': from_addr,
|
||||
})
|
||||
|
||||
# Save attachments
|
||||
for att_data in attachments:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user