diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-05-09 10:41:44 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-06-13 18:16:05 +0200 |
commit | 5b0c5f805eb444269668e318082ec7809719ff8f (patch) | |
tree | 35d048c9a4568937785cabb3a8fc669998d5f323 /ishtar_common/models_rest.py | |
parent | 2213cdd8fd06f5df85c14fd7306ba2fdfab831e2 (diff) | |
download | Ishtar-5b0c5f805eb444269668e318082ec7809719ff8f.tar.bz2 Ishtar-5b0c5f805eb444269668e318082ec7809719ff8f.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.py | 11 |
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() |