Neue Verwaltung der Gruppenzuordnung 1:n
This commit is contained in:
1 parent
fa02a7ade0
commit
02c017d53d
34 files changed
+1306
-251
No files matched your search
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Hilfsfunktionen für CMBNet
|
||||
"""
|
||||
from flask import g
|
||||
from flask import current_app, g
|
||||
import json
|
||||
|
||||
|
||||
@@ -15,6 +15,33 @@ def get_current_account():
|
||||
return getattr(g, 'current_account', None)
|
||||
|
||||
|
||||
def notify_reload(text, tenant_id=None, sender_id=None):
|
||||
"""Sendet eine interne Code-99-Nachricht an alle Clients eines Mandanten."""
|
||||
from cmbnet.ws import broker
|
||||
from cmbnet.ws.protocol import WSMessage
|
||||
|
||||
tenant_id = tenant_id if tenant_id is not None else get_tenant_id()
|
||||
account = get_current_account()
|
||||
if sender_id is None and account:
|
||||
sender_id = account['id']
|
||||
|
||||
if not tenant_id or not sender_id:
|
||||
return False
|
||||
|
||||
try:
|
||||
broker.route_message(
|
||||
tenant_id,
|
||||
WSMessage(sender_id=sender_id, code=99, msg=str(text))
|
||||
)
|
||||
return True
|
||||
except Exception as exc:
|
||||
try:
|
||||
current_app.logger.warning('Code-99-Nachricht konnte nicht gesendet werden: %s', exc)
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
def log_transaction(action, entity_type, entity_id, details=None):
|
||||
"""
|
||||
Schreibt einen Eintrag ins Transaktionslog
|
||||
|
||||
Reference in new issue
Block a user