chg: [investigations] show organisation

otp
terrtia 2024-09-06 11:52:19 +02:00
parent a51347bf3c
commit b030382cdf
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
4 changed files with 27 additions and 3 deletions

View File

@ -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

View File

@ -47,6 +47,14 @@ def investigations_dashboard():
return render_template("investigations.html", bootstrap_label=bootstrap_label,
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 ????
@login_required
@ -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)

View File

@ -38,6 +38,7 @@
<thead class="bg-dark text-white">
<tr>
<th>Name</th>
<th>Org</th>
<th>Date</th>
<th>last modified</th>
<td>Info</td>
@ -57,6 +58,7 @@
</div>
</a>
</td>
<td>{{ dict_investigation['org_name']}}<br>{{ dict_investigation['org'] }}</td>
<td>{{ dict_investigation['date']}}</td>
<td>{{ dict_investigation['last_change']}}</td>
<td>{{ dict_investigation['info']}}</td>

View File

@ -47,6 +47,10 @@
<th>Creator</th>
<td>{{metadata['user_creator']}}</td>
</tr>
<tr>
<th>Org</th>
<td>{{metadata['org_name']}}<br>{{ metadata['org'] }}</td>
</tr>
<tr>
<th>Level</th>
<td>