chg: [trackers UI] add admin endpoint

This commit is contained in:
Terrtia 2023-05-12 09:25:17 +02:00
parent d4766c5adc
commit f4d20533cc
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 16 additions and 0 deletions

View file

@ -648,6 +648,14 @@ def get_global_trackers_meta(tracker_type=None):
metas.append(tracker.get_meta(options={'mails', 'sparkline', 'tags'}))
return metas
def get_users_trackers_meta():
trackers = []
for tracker_uuid in get_trackers():
tracker = Tracker(tracker_uuid)
if tracker.is_level_user():
trackers.append(tracker.get_meta(options={'mails', 'sparkline', 'tags'}))
return trackers
def get_trackers_graph_by_day(l_trackers, num_day=31, date_from=None, date_to=None):
if date_from and date_to:
date_range = Date.substract_date(date_from, date_to)

View file

@ -129,6 +129,14 @@ def tracked_menu_typosquatting():
return render_template("trackersManagement.html", user_trackers=user_trackers, global_trackers=global_trackers,
bootstrap_label=bootstrap_label, tracker_type=tracker_type)
@hunters.route("/trackers/admin")
@login_required
@login_admin
def tracked_menu_admin():
user_trackers = Tracker.get_users_trackers_meta()
return render_template("trackersManagement.html", user_trackers=user_trackers, global_trackers=[],
bootstrap_label=bootstrap_label)
@hunters.route("/tracker/show")
@login_required