mirror of https://github.com/CIRCL/AIL-framework
chg: [investigations] show organisation
parent
a51347bf3c
commit
b030382cdf
|
@ -224,6 +224,8 @@ class Investigation(object):
|
||||||
}
|
}
|
||||||
if 'objects' in options:
|
if 'objects' in options:
|
||||||
meta['objects'] = self.get_objects()
|
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
|
return meta
|
||||||
|
|
||||||
def set_name(self, name):
|
def set_name(self, name):
|
||||||
|
@ -438,7 +440,15 @@ def get_org_investigations_meta(org_uuid, r_str=False):
|
||||||
investigations_meta = []
|
investigations_meta = []
|
||||||
for investigation_uuid in get_org_investigations(org_uuid):
|
for investigation_uuid in get_org_investigations(org_uuid):
|
||||||
investigation = Investigation(investigation_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
|
return investigations_meta
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,14 @@ def investigations_dashboard():
|
||||||
return render_template("investigations.html", bootstrap_label=bootstrap_label,
|
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 ????
|
@investigations_b.route("/investigation", methods=['GET']) ## FIXME: add /view ????
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -63,7 +71,7 @@ def show_investigation():
|
||||||
if res:
|
if res:
|
||||||
return create_json_response(res[0], res[1])
|
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 = []
|
objs = []
|
||||||
for obj in investigation.get_objects():
|
for obj in investigation.get_objects():
|
||||||
obj_meta = ail_objects.get_object_meta(obj["type"], obj["subtype"], obj["id"], flask_context=True)
|
obj_meta = ail_objects.get_object_meta(obj["type"], obj["subtype"], obj["id"], flask_context=True)
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
<thead class="bg-dark text-white">
|
<thead class="bg-dark text-white">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
<th>Org</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>last modified</th>
|
<th>last modified</th>
|
||||||
<td>Info</td>
|
<td>Info</td>
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td>{{ dict_investigation['org_name']}}<br>{{ dict_investigation['org'] }}</td>
|
||||||
<td>{{ dict_investigation['date']}}</td>
|
<td>{{ dict_investigation['date']}}</td>
|
||||||
<td>{{ dict_investigation['last_change']}}</td>
|
<td>{{ dict_investigation['last_change']}}</td>
|
||||||
<td>{{ dict_investigation['info']}}</td>
|
<td>{{ dict_investigation['info']}}</td>
|
||||||
|
|
|
@ -47,6 +47,10 @@
|
||||||
<th>Creator</th>
|
<th>Creator</th>
|
||||||
<td>{{metadata['user_creator']}}</td>
|
<td>{{metadata['user_creator']}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Org</th>
|
||||||
|
<td>{{metadata['org_name']}}<br>{{ metadata['org'] }}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Level</th>
|
<th>Level</th>
|
||||||
<td>
|
<td>
|
||||||
|
|
Loading…
Reference in New Issue