From f4d20533ccbc42bcce137c80438146d67b0eefc7 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Fri, 12 May 2023 09:25:17 +0200 Subject: [PATCH] chg: [trackers UI] add admin endpoint --- bin/lib/Tracker.py | 8 ++++++++ var/www/blueprints/hunters.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/bin/lib/Tracker.py b/bin/lib/Tracker.py index 84f0f3b6..15f5dc17 100755 --- a/bin/lib/Tracker.py +++ b/bin/lib/Tracker.py @@ -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) diff --git a/var/www/blueprints/hunters.py b/var/www/blueprints/hunters.py index 08316d4f..b2a2e30b 100644 --- a/var/www/blueprints/hunters.py +++ b/var/www/blueprints/hunters.py @@ -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