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:
@@ -15,6 +15,7 @@ from typing import Any
|
||||
|
||||
from app.plugins.base import BasePlugin
|
||||
from app.plugins.manifest import (
|
||||
CronJobContribution,
|
||||
FrontendMenuItem,
|
||||
FrontendPageRoute,
|
||||
FrontendSettingsPage,
|
||||
@@ -92,6 +93,29 @@ class AutomationPlugin(BasePlugin):
|
||||
order=60,
|
||||
),
|
||||
],
|
||||
cron_jobs=[
|
||||
CronJobContribution(
|
||||
name="backup_check",
|
||||
cron_expression="0 2 * * *",
|
||||
job_type="custom",
|
||||
target_name="backup_check",
|
||||
plugin_name="automation",
|
||||
),
|
||||
CronJobContribution(
|
||||
name="search_index_check",
|
||||
cron_expression="0 3 * * *",
|
||||
job_type="custom",
|
||||
target_name="search_index_check",
|
||||
plugin_name="automation",
|
||||
),
|
||||
CronJobContribution(
|
||||
name="check_workflow_timeouts",
|
||||
cron_expression="*/5 * * * *",
|
||||
job_type="custom",
|
||||
target_name="check_workflow_timeouts",
|
||||
plugin_name="automation",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
def __init__(self) -> None:
|
||||
@@ -127,6 +151,12 @@ class AutomationPlugin(BasePlugin):
|
||||
logger.info("Registered MiniApp '%s' from manifest", miniapp.app_id)
|
||||
except Exception:
|
||||
logger.exception("Failed to register MiniApps from manifest")
|
||||
# Register own cron jobs from manifest
|
||||
try:
|
||||
await self.register_plugin_contributions(db, self.manifest.name, self.manifest)
|
||||
logger.info("Registered own cron jobs from manifest")
|
||||
except Exception:
|
||||
logger.exception("Failed to register own cron jobs")
|
||||
logger.info("Automation plugin activated")
|
||||
|
||||
async def on_deactivate(self, db, service_container, event_bus) -> None:
|
||||
|
||||
Reference in New Issue
Block a user