From 35c8b4f5359317159b5b37cdc0647b076f89fe1e Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Wed, 27 Mar 2024 17:28:32 +0000 Subject: [PATCH] add mgmt command to get mesh login url --- .../management/commands/get_mesh_login_url.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 api/tacticalrmm/core/management/commands/get_mesh_login_url.py diff --git a/api/tacticalrmm/core/management/commands/get_mesh_login_url.py b/api/tacticalrmm/core/management/commands/get_mesh_login_url.py new file mode 100644 index 00000000..b6c8fc07 --- /dev/null +++ b/api/tacticalrmm/core/management/commands/get_mesh_login_url.py @@ -0,0 +1,19 @@ +from django.core.management.base import BaseCommand +from meshctrl.utils import get_login_token + +from core.utils import get_core_settings + + +class Command(BaseCommand): + help = "generate a url to login to mesh as the superuser" + + def handle(self, *args, **kwargs): + + core = get_core_settings() + + token = get_login_token(key=core.mesh_token, user=f"user//{core.mesh_username}") + token_param = f"login={token}&" + + control = f"{core.mesh_site}/?{token_param}" + + self.stdout.write(self.style.SUCCESS(control))