Compare commits
2 commits
8a64f84140
...
d637f2a0ee
Author | SHA1 | Date | |
---|---|---|---|
|
d637f2a0ee | ||
|
7ed839d391 |
3 changed files with 21 additions and 1 deletions
|
@ -322,6 +322,8 @@ def get_progress():
|
||||||
completion_for_users = get_completion_for_users()
|
completion_for_users = get_completion_for_users()
|
||||||
progress = {}
|
progress = {}
|
||||||
for user_id in completion_for_users.keys():
|
for user_id in completion_for_users.keys():
|
||||||
|
if user_id not in db.USER_ID_TO_EMAIL_MAPPING:
|
||||||
|
continue
|
||||||
progress[user_id] = {
|
progress[user_id] = {
|
||||||
'email': db.USER_ID_TO_EMAIL_MAPPING[user_id],
|
'email': db.USER_ID_TO_EMAIL_MAPPING[user_id],
|
||||||
'exercises': {},
|
'exercises': {},
|
||||||
|
|
|
@ -197,4 +197,21 @@ def is_accepted_notification(notification) -> bool:
|
||||||
return True
|
return True
|
||||||
elif action in config.live_logs_accepted_scope[scope]:
|
elif action in config.live_logs_accepted_scope[scope]:
|
||||||
return True
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def is_accepted_user_activity(notification) -> bool:
|
||||||
|
global VERBOSE_MODE
|
||||||
|
|
||||||
|
if notification['user_agent'] == 'misp-exercise-dashboard': # Ignore message generated from this app
|
||||||
|
return False
|
||||||
|
if '@' not in notification['user']: # Ignore message from system
|
||||||
|
return False
|
||||||
|
|
||||||
|
scope, action = get_scope_action_from_url(notification['url'])
|
||||||
|
if scope in config.uesr_activity_accepted_scope:
|
||||||
|
if config.uesr_activity_accepted_scope == '*':
|
||||||
|
return True
|
||||||
|
elif action in config.uesr_activity_accepted_scope[scope]:
|
||||||
|
return True
|
||||||
return False
|
return False
|
|
@ -150,10 +150,11 @@ async def handleMessage(topic, s, message):
|
||||||
if notification_model.is_accepted_notification(notification):
|
if notification_model.is_accepted_notification(notification):
|
||||||
notification_model.record_notification(notification)
|
notification_model.record_notification(notification)
|
||||||
ZMQ_MESSAGE_COUNT_LAST_TIMESPAN += 1
|
ZMQ_MESSAGE_COUNT_LAST_TIMESPAN += 1
|
||||||
|
await sio.emit('notification', notification)
|
||||||
|
if notification_model.is_accepted_user_activity(notification):
|
||||||
user_id = notification_model.get_user_id(data)
|
user_id = notification_model.get_user_id(data)
|
||||||
if user_id is not None:
|
if user_id is not None:
|
||||||
USER_ACTIVITY[user_id] += 1
|
USER_ACTIVITY[user_id] += 1
|
||||||
await sio.emit('notification', notification)
|
|
||||||
|
|
||||||
user_id = notification_model.get_user_id(data)
|
user_id = notification_model.get_user_id(data)
|
||||||
if user_id is not None:
|
if user_id is not None:
|
||||||
|
|
Loading…
Reference in a new issue