summaryrefslogtreecommitdiff
path: root/ishtar_common/models_rest.py
diff options
context:
space:
mode:
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()