summaryrefslogtreecommitdiff
path: root/ishtar_common/models_rest.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-05-09 10:41:44 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-10-15 19:32:59 +0200
commit16146deb2e76bb77f9566e0c3d5f21fd98d0f65c (patch)
tree0aeb1358e2cc4a640845885e1179390b7656f54f /ishtar_common/models_rest.py
parent99ca4cbcf573cdd80ab525d573b1f0e3ab738057 (diff)
downloadIshtar-16146deb2e76bb77f9566e0c3d5f21fd98d0f65c.tar.bz2
Ishtar-16146deb2e76bb77f9566e0c3d5f21fd98d0f65c.zip
✨ GIS API: manage GIS connections (list, request token, create token, delete)
Diffstat (limited to 'ishtar_common/models_rest.py')
-rw-r--r--ishtar_common/models_rest.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ishtar_common/models_rest.py b/ishtar_common/models_rest.py
index e26968daf..f6b21a14a 100644
--- a/ishtar_common/models_rest.py
+++ b/ishtar_common/models_rest.py
@@ -58,6 +58,17 @@ class UserRequestToken(models.Model):
verbose_name_plural = _("API - GIS - Request tokens")
ADMIN_SECTION = _("API")
+ @property
+ def access_type_label(self):
+ if self.access_type in API_ACCESS_TYPES_DICT:
+ return API_ACCESS_TYPES_DICT[self.access_type]
+ return ""
+
+ @property
+ def expiry(self):
+ timeout = timezone.now() - self.created
+ return settings.ISHTAR_REQUEST_TOKEN_TIMEOUT - timeout.seconds
+
@classmethod
def clean_keys(cls):
profile = get_current_profile()