From 72e24af4d4828615500a22b90602a1d1f6b97da0 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Mon, 8 Mar 2021 16:33:52 +0100 Subject: [PATCH] fix: [MISP Export UI] object type selector --- bin/export/AILObjects.py | 6 ++--- var/www/blueprints/import_export.py | 1 - .../import_export/block_to_export_input.html | 23 ++++++++++--------- .../import_export/export_object.html | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/bin/export/AILObjects.py b/bin/export/AILObjects.py index 093a0f0f..37560545 100755 --- a/bin/export/AILObjects.py +++ b/bin/export/AILObjects.py @@ -28,15 +28,15 @@ def create_map_obj_event_uuid(event_uuid, global_id): r_serv_objects.sadd('object:map:id_event:{}'.format(global_id), event_uuid) def get_user_list_of_obj_to_export(user_id, add_uuid=False): - set_objs_to_export = [] + objs_to_export = [] res = r_serv_objects.hgetall('user:all_objs_to_export:{}'.format(user_id)) for global_id in res: dict_obj = Correlate_object.get_global_id_from_id(global_id) dict_obj['lvl'] = int(res[global_id]) if add_uuid: obj_dict['uuid'] = str(uuid.uuid4()) - set_objs_to_export.append(dict_obj) - return set_objs_to_export + objs_to_export.append(dict_obj) + return objs_to_export def add_user_object_to_export(user_id, obj_type, obj_id, lvl, obj_subtype=None): ## TODO: check if user exist diff --git a/var/www/blueprints/import_export.py b/var/www/blueprints/import_export.py index ddb3b534..bd8879e1 100644 --- a/var/www/blueprints/import_export.py +++ b/var/www/blueprints/import_export.py @@ -83,7 +83,6 @@ def import_object_file(): @login_analyst def export_object(): user_id = current_user.get_id() - l_obj_to_export = set() # get user saved obj to export l_obj_to_export = AILObjects.get_user_list_of_obj_to_export(user_id) diff --git a/var/www/templates/import_export/block_to_export_input.html b/var/www/templates/import_export/block_to_export_input.html index b5faf733..86ebe14d 100644 --- a/var/www/templates/import_export/block_to_export_input.html +++ b/var/www/templates/import_export/block_to_export_input.html @@ -9,16 +9,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -26,7 +26,8 @@
{%if obj_type=="Object type..."%}     Please select an object type. + {%else%} +              Unknow or Invalid ID. {%endif%} -              Unknow or Invalid ID.
diff --git a/var/www/templates/import_export/export_object.html b/var/www/templates/import_export/export_object.html index f97a64d9..95724e0d 100644 --- a/var/www/templates/import_export/export_object.html +++ b/var/www/templates/import_export/export_object.html @@ -73,7 +73,7 @@ {% for obj_dict in l_obj_to_export %} - {% with obj_type=obj_dict['type'], obj_id=obj_dict['id'], obj_lvl=obj_dict['lvl'], input_uuid=obj_dict, obj_error=False%} + {% with obj_type=obj_dict['type'], obj_subtype=obj_dict.get('subtype', None), obj_id=obj_dict['id'], obj_lvl=obj_dict['lvl'], input_uuid=obj_dict, obj_error=False%} {% include 'import_export/block_to_export_input.html' %} {% endwith %} {% endfor %} @@ -81,7 +81,7 @@
{% for obj_dict in l_obj_invalid %} - {% with obj_type=obj_dict['type'], obj_id=obj_dict['id'], obj_lvl=obj_dict['lvl'], input_uuid=obj_dict['uuid'], obj_error=True%} + {% with obj_type=obj_dict['type'], obj_subtype=obj_dict.get('subtype', None), obj_id=obj_dict['id'], obj_lvl=obj_dict['lvl'], input_uuid=obj_dict['uuid'], obj_error=True%} {% include 'import_export/block_to_export_input.html' %} {% endwith %} {% endfor %}