From dfbd9bab8cfcd6078ca3e4b1b59a20415588a435 Mon Sep 17 00:00:00 2001
From: Dominik Rimpf <dominik.rimpf@kit.edu>
Date: Fri, 13 Oct 2023 19:20:40 +0200
Subject: [PATCH] add: fqdn token template

---
 json_templates/fqdn_token.json | 129 +++++++++++++++++++++++++++++++++
 1 file changed, 129 insertions(+)
 create mode 100644 json_templates/fqdn_token.json

diff --git a/json_templates/fqdn_token.json b/json_templates/fqdn_token.json
new file mode 100644
index 0000000..56a436a
--- /dev/null
+++ b/json_templates/fqdn_token.json
@@ -0,0 +1,129 @@
+{
+  "schema_version": 1,
+  "author": "NETVS Team <netvs@scc.kit.edu>",
+  "target_api": "4.0",
+  "name": {
+    "de": "Token anlegen",
+    "en": "Create token"
+  },
+  "description": {
+    "de": "Ein Token mit Berechtigungen für Domains anlegen",
+    "en": "Create a token for a set of domains"
+  },
+  "list_display_name": {
+    "de": "Ein Token mit Berechtigungen für Domains anlegen",
+    "en": "Create a token for a set of domains"
+  },
+  "display_variant": "create",
+  "variables": {
+    "description": {
+      "friendly_name": {
+        "de": "Beschreibung",
+        "en": "Description"
+      },
+      "optional": false,
+      "default": "",
+      "nullable": false,
+      "description": {
+        "de": "Aussagekräftige Beschreibung wo der Token genutzt wird. Bspw. Hostname.",
+        "en": "Meaningful description where the token is used. For example, host name."
+      },
+      "type": "str"
+    },
+    "group_name": {
+      "friendly_name": {
+        "de": "Gruppe",
+        "en": "Group"
+      },
+      "optional": false,
+      "default": "",
+      "nullable": true,
+      "description": {
+        "de": "Gruppe in der die Subgruppe für den Subaccount angelegt werden soll.",
+        "en": "Group in which the subgroup for the subaccount should be created."
+      },
+      "type": "typeahead",
+      "type_params": {
+        "query": [
+          {"idx": "group_list", "name": "cntl.group.list", "old": {"is_own": true, "is_sub": false}}
+        ],
+        "query_path": "group_list",
+        "display_value": "name",
+        "return_value": "name"
+      }
+    },
+    "domains": {
+      "friendly_name": {
+        "de": "Domains",
+        "en": "Domains"
+      },
+      "optional": false,
+      "default": "",
+      "nullable": false,
+      "description": {
+        "de": "Domains, für die Zertifikate bestellt werden können sollen. Subdomains dieser Domains sind automatisch mit eingeschlossen.",
+        "en": "Domains for which certificates should be ordered. Subdomains of these domains are automatically included."
+      },
+      "list": true,
+      "type": "str"
+    }
+  },
+  "transaction": [
+    {
+      "idx": "createSubMgr",
+      "name": "cntl.mgr.create",
+      "new": {
+        "allow_data_manipulation": true,
+        "description": "{{ description }}",
+        "do_copy_roles": true,
+        "is_svc": false
+      }
+    },
+    {
+      "idx": "createSubGroup",
+      "name": "cntl.group.create",
+      "new": {
+          "description": "{{ description }}",
+          "do_copy_assignments": false,
+          "do_idm_sync": false,
+          "do_refresh_idm_sync": false,
+          "idm_sync_max_mgr_count": 20,
+          "parent_name": "{{ group_name }}"
+      }
+    },
+    {
+      "idx": "addMgrToSubGroup",
+      "name": "cntl.mgr2group.create",
+      "new_ref_params": [
+        {"idx": "createSubGroup", "params": {"group_name": "name"}},
+        {"idx": "createSubMgr", "params": {"mgr_login_name": "login_name"}, "join_type": "inner"}
+      ]
+    },
+    {
+      "idx": "getFQDNS",
+      "name": "dns.fqdn.list",
+      "old": {
+        "value_list": "{{ domains }}"
+      }
+    },
+    {
+      "idx": "fqdn2group",
+      "name": "dns.fqdn2group.create",
+      "new_ref_params": [
+        {"idx": "createSubGroup", "params": {"group_name": "name"}},
+        {"idx": "getFQDNS", "params": {"fqdn_value": "value"}, "join_type": "cross"}
+      ]
+    },
+    {
+      "idx": "createToken",
+      "name": "cntl.wapi_auth.create",
+      "new": {
+          "description": "{{ description }}"
+      },
+      "new_ref_params": [
+        {"idx": "createSubMgr", "params": {"login_name":  "login_name"}}
+      ]
+	}
+  ],
+  "returning": []
+}
\ No newline at end of file
-- 
GitLab