diff --git a/bin/lib/Investigations.py b/bin/lib/Investigations.py index e1164933..1b35256c 100755 --- a/bin/lib/Investigations.py +++ b/bin/lib/Investigations.py @@ -224,6 +224,8 @@ class Investigation(object): } if 'objects' in options: meta['objects'] = self.get_objects() + if 'org_name' in options and meta['org']: + meta['org_name'] = ail_orgs.Organisation(self.get_org()).get_name() return meta def set_name(self, name): @@ -438,7 +440,15 @@ def get_org_investigations_meta(org_uuid, r_str=False): investigations_meta = [] for investigation_uuid in get_org_investigations(org_uuid): investigation = Investigation(investigation_uuid) - investigations_meta.append(investigation.get_metadata(r_str=r_str)) + investigations_meta.append(investigation.get_metadata(r_str=r_str, options={'org_name'})) + return investigations_meta + +def get_orgs_investigations_meta(r_str=False): + investigations_meta = [] + for tracker_uuid in get_all_investigations(): + inv = Investigation(tracker_uuid) + if inv.get_level() == 2: + investigations_meta.append(inv.get_metadata(r_str=r_str, options={'org_name'})) return investigations_meta diff --git a/var/www/blueprints/investigations_b.py b/var/www/blueprints/investigations_b.py index 726f6759..a4c08c5f 100644 --- a/var/www/blueprints/investigations_b.py +++ b/var/www/blueprints/investigations_b.py @@ -45,7 +45,15 @@ def investigations_dashboard(): inv_global = Investigations.get_global_investigations_meta(r_str=True) inv_org = Investigations.get_org_investigations_meta(current_user.get_org(), r_str=True) return render_template("investigations.html", bootstrap_label=bootstrap_label, - inv_global=inv_global, inv_org=inv_org) + inv_global=inv_global, inv_org=inv_org) + +@investigations_b.route("/investigations/admin", methods=['GET']) +@login_required +@login_admin +def investigations_admin(): + inv_org = Investigations.get_orgs_investigations_meta(r_str=True) + return render_template("investigations.html", bootstrap_label=bootstrap_label, + inv_global=[], inv_org=inv_org) @investigations_b.route("/investigation", methods=['GET']) ## FIXME: add /view ???? @@ -63,7 +71,7 @@ def show_investigation(): if res: return create_json_response(res[0], res[1]) - metadata = investigation.get_metadata(r_str=True) + metadata = investigation.get_metadata(r_str=True, options={'org_name'}) objs = [] for obj in investigation.get_objects(): obj_meta = ail_objects.get_object_meta(obj["type"], obj["subtype"], obj["id"], flask_context=True) diff --git a/var/www/templates/investigations/investigations.html b/var/www/templates/investigations/investigations.html index 87082326..c7ec711c 100644 --- a/var/www/templates/investigations/investigations.html +++ b/var/www/templates/investigations/investigations.html @@ -38,6 +38,7 @@ Name + Org Date last modified Info @@ -57,6 +58,7 @@ + {{ dict_investigation['org_name']}}
{{ dict_investigation['org'] }} {{ dict_investigation['date']}} {{ dict_investigation['last_change']}} {{ dict_investigation['info']}} diff --git a/var/www/templates/investigations/view_investigation.html b/var/www/templates/investigations/view_investigation.html index c3143359..e9d87ea3 100644 --- a/var/www/templates/investigations/view_investigation.html +++ b/var/www/templates/investigations/view_investigation.html @@ -47,6 +47,10 @@ Creator {{metadata['user_creator']}} + + Org + {{metadata['org_name']}}
{{ metadata['org'] }} + Level