django-restit 4.2.161__py3-none-any.whl → 4.2.163__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
account/rpc/auth.py CHANGED
@@ -3,7 +3,7 @@ from rest import crypto
3
3
  from rest.mail import render_to_mail
4
4
  from rest import views as rv
5
5
  # from rest.views import restStatus, restGet, restPermissionDenied
6
- from rest.jwtoken import JWToken, JWT_KEY
6
+ from rest.jwtoken import JWToken, JWT_KEY, JWT_EXPIRES, JWT_REFRESH_EXPIRES
7
7
  from rest import helpers
8
8
  from rest import settings
9
9
  from account import models as am
@@ -67,7 +67,13 @@ def on_complete_jwt(request, member):
67
67
  request, method="login", level=7)
68
68
 
69
69
  device_id = request.DATA.get(["device_id", "deviceID"])
70
- token = JWToken(user_id=member.pk, key=member.security_token, device_id=device_id)
70
+
71
+ token = JWToken(
72
+ user_id=member.pk,
73
+ key=member.security_token,
74
+ device_id=device_id,
75
+ access_expires_in=member.getProperty("jwt.expires_in", JWT_EXPIRES, field_type=int),
76
+ refresh_expires_in=member.getProperty("jwt.refresh_expires_in", JWT_REFRESH_EXPIRES, field_type=int))
71
77
 
72
78
  request.user = member.getUser()
73
79
  request.member = member
@@ -121,9 +127,10 @@ def jwt_refresh(request):
121
127
  if member.security_token is None:
122
128
  member.refreshSecurityToken()
123
129
  member.canLogin(request)
124
- token.refresh()
130
+ token.refresh(member.getProperty("jwt.expires_in", JWT_EXPIRES, field_type=int))
125
131
  request.jwt_token = token.access_token # this tells the middleware to store in cookie
126
132
  if JWT_UPDATE_REFRESH_TOKEN:
133
+ token.refresh_expires_in = member.getProperty("jwt.refresh_expires_in", JWT_REFRESH_EXPIRES, field_type=int)
127
134
  rtoken = token.refresh_token
128
135
  return rv.restGet(request, dict(access=token.access_token, refresh=rtoken))
129
136
 
account/rpc/group.py CHANGED
@@ -15,7 +15,7 @@ def rest_on_group(request, pk=None):
15
15
  @rd.urlGET(r'^member/groups$')
16
16
  @rd.login_required
17
17
  def member_groups(request):
18
- member_id = request.DATA.get(["member", "member_id"])
18
+ member_id = request.DATA.get(["member", "member_id"], request.member.id)
19
19
  if not member_id:
20
20
  return rv.restPermissionDenied(request)
21
21
  member = Member.objects.filter(pk=member_id).last()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-restit
3
- Version: 4.2.161
3
+ Version: 4.2.163
4
4
  Summary: A Rest Framework for DJANGO
5
5
  License: MIT
6
6
  Author: Ian Starnes
@@ -42,9 +42,9 @@ account/passkeys/__init__.py,sha256=FwXYJXwSJXfkLojGBcVpF1dFpgFhzDdd9N_3naYQ0cc,
42
42
  account/passkeys/core.py,sha256=4aUBNCuF_kjOvE1zFapK1Pj28ap5slO71dRyfnWi0YU,4148
43
43
  account/periodic.py,sha256=-u0n-7QTJgDOkasGhBAPwHAwjpqWGA-MZLEFkVTqCGU,874
44
44
  account/rpc/__init__.py,sha256=SGF0M_-H0dKh3b1apSX29BotNWAvITYccGQVC0MIjL8,336
45
- account/rpc/auth.py,sha256=p62tyihWvSY2zn7eaVxKcCG9qLnnZBIkwdRH81sS5_Y,16615
45
+ account/rpc/auth.py,sha256=O-co_vZM9T4lsu3hidjKAeL2tTPWgbmoLsrjhmFZ7lA,17064
46
46
  account/rpc/device.py,sha256=lU2BHNPreHV0dDTjAPc7Sc-5m2JP8SiWVqiKuBfV7Fo,2281
47
- account/rpc/group.py,sha256=riymUK6ttv8G6SG6K-v7UCvM40WQy3HaGSeF_sEiaU0,4929
47
+ account/rpc/group.py,sha256=hw7iczZ6W_IrRbx5ZDw6cZ5I_ztqxhtUFJD9WR91_4s,4948
48
48
  account/rpc/member.py,sha256=8XnJX-iri0Om4nc-V2_tDJzfCSzziKLw6dUx9egtEZE,2236
49
49
  account/rpc/notify.py,sha256=Q2YWejP36egeF060Hih5uX4Psv_B8NWlLLPi7iDYlIw,3344
50
50
  account/rpc/oauth.py,sha256=ISLVsR5HvKALANokaOFRvF4FTRxWtXPvVnZAYANKxpo,2864
@@ -378,7 +378,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
378
378
  rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
379
379
  rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
380
380
  rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
381
- rest/__init__.py,sha256=ZZl-QgQmlrNh4Joe-BilCYkrd4rBnztS0KqzxKAYu3s,122
381
+ rest/__init__.py,sha256=Nt-ARrrsZsC3MhlB1KngYyIlg503R8BDL8rspDoD3-U,122
382
382
  rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
383
383
  rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
384
384
  rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
@@ -396,7 +396,7 @@ rest/fields.py,sha256=_v1TJVc6vyWlqmwFRJ6mtuR5Fo-lS0KcUhPWIrzKZUo,9719
396
396
  rest/forms.py,sha256=66Wm5cdy8tKib_mGicjq_yd-gNVMFWRECnrDksnNnwU,6316
397
397
  rest/helpers.py,sha256=t7smlOUzchVno-zeq7xMJIwogAR2DeSrffWxgysOHX8,29531
398
398
  rest/joke.py,sha256=0PpKaX2iN7jlS62kgjfmmqkFBYLPURz15aQ8R7OJkJ8,260
399
- rest/jwtoken.py,sha256=6AIe9IpsOn44sodiV0OPYeTZZNhS8VRiakV-rOuCyGw,2444
399
+ rest/jwtoken.py,sha256=F7Vvpm31rAplTXr8XFP-Lb4BnDB3j1B2nQq0P1iTCLQ,2576
400
400
  rest/log.py,sha256=hd1_4HBOS395sfXJIL6BTw9yekm1SLgBwYx_PdfIhKA,20930
401
401
  rest/mail.py,sha256=Rm40hWDYop0tMqxdN-J2NT-dCnP-f4SfCZxSO02ajzs,7965
402
402
  rest/mailman.py,sha256=v5O1G5s3HiAKmz-J1z0uT6_q3xsONPpxVl9saEyQQ2I,9174
@@ -413,7 +413,7 @@ rest/middleware/session_store.py,sha256=1nSdeXK8PyuYgGgIufqrS6j6QpIrQ7zbMNT0ol75
413
413
  rest/models/__init__.py,sha256=M8pvFDq-WCF-QcM58X7pMufYYe0aaQ3U0PwGe9TKbbY,130
414
414
  rest/models/base.py,sha256=eOvVDwHgKDdBJAnaK2xavGfkjkfpk5Oqy1KfKRjtu6o,72072
415
415
  rest/models/cacher.py,sha256=eKz8TINVhWEqKhJGMsRkKZTtBUIv5rN3NHbZwOC56Uk,578
416
- rest/models/metadata.py,sha256=1nQ7CYo9bJHoaXE_hVNaj1-Y7yqhHlf2ZlaD1IfTzic,12904
416
+ rest/models/metadata.py,sha256=ni8-BRF07lv4CdPUWnUdfPTOClQAVEeRZvO-ic623HU,12904
417
417
  rest/net.py,sha256=LcB2QV6VNRtsSdmiQvYZgwQUDwOPMn_VBdRiZ6OpI-I,2974
418
418
  rest/regexes.yaml,sha256=VoGb4E-P_K9f82Yzcpltgzekpt9usRtwu9PYlo46nUw,149463
419
419
  rest/requestex.py,sha256=N56056vV3zWkAP-QrYsCu7SdpPzE5kLuPoxGIuZAKt0,16127
@@ -460,7 +460,7 @@ taskqueue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
460
460
  taskqueue/admin.py,sha256=E6zXoToS_ea3MdoGjZzF1JiepWFtDSoZUQdan8H-pXI,208
461
461
  taskqueue/migrations/0001_initial.py,sha256=JwYib8CK5ftSXlfxKZUcKEEVsXktNB5q3h-2tu9inGk,4738
462
462
  taskqueue/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
463
- taskqueue/models.py,sha256=Q4kAo-1pELdBpS5IkSLiDLJ5-hu4Qa0GG0ERoW0XLg4,23855
463
+ taskqueue/models.py,sha256=aRy5TFc2zAu6xcb3jcMf-bfma-dmrh55hQoktCLT0Us,23894
464
464
  taskqueue/periodic.py,sha256=hpXnunJL_cuVQLAKpjTbABbsQ4fvdsV9_gyyK-_53Sk,3844
465
465
  taskqueue/rpc.py,sha256=Lf5VUoqCRkfWUAIvx_s508mjAtDPwpiWyxg0ryqWbQA,5793
466
466
  taskqueue/tq.py,sha256=PzSoDrawYcqZylruEgsK95gcJ4J_VhdM6rxg9V6_X8E,942
@@ -514,7 +514,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
514
514
  ws4redis/settings.py,sha256=KKq00EwoGnz1yLwCZr5Dfoq2izivmAdsNEEM4EhZwN4,1610
515
515
  ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
516
516
  ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
517
- django_restit-4.2.161.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
518
- django_restit-4.2.161.dist-info/METADATA,sha256=RlhvubtGorzBm7GK3EeMvv9SdwFB3oTHnl_jz1cNsM4,7663
519
- django_restit-4.2.161.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
520
- django_restit-4.2.161.dist-info/RECORD,,
517
+ django_restit-4.2.163.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
518
+ django_restit-4.2.163.dist-info/METADATA,sha256=JJ41qj2ZvwUoUmELr-Bbz-Wo1RIqLKBhsR46q2sw49o,7663
519
+ django_restit-4.2.163.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
520
+ django_restit-4.2.163.dist-info/RECORD,,
rest/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from .uberdict import UberDict # noqa: F401
2
2
  from .settings_helper import settings # noqa: F401
3
3
 
4
- __version__ = "4.2.161"
4
+ __version__ = "4.2.163"
rest/jwtoken.py CHANGED
@@ -4,7 +4,8 @@ import time
4
4
  import uuid
5
5
  from rest import settings
6
6
 
7
-
7
+ JWT_EXP_6_HOURS = 21600
8
+ JWT_EXP_12_HOURS = 43200
8
9
  JWT_EXP_1_DAY = 86400
9
10
  JWT_EXP_2_DAY = 172800
10
11
  JWT_EXP_7_DAY = 604800
@@ -58,10 +59,12 @@ class JWToken():
58
59
  return False
59
60
  return self.payload.exp > time.time()
60
61
 
61
- def refresh(self):
62
+ def refresh(self, expires_in=None):
62
63
  self.payload["token_type"] = "access"
63
64
  self.payload["iat"] = int(time.time())
64
- self.payload["exp"] = int(time.time()) + self.access_expires_in
65
+ if expires_in is None:
66
+ expires_in = self.access_expires_in
67
+ self.payload["exp"] = int(time.time()) + expires_in
65
68
 
66
69
  @property
67
70
  def access_token(self):
rest/models/metadata.py CHANGED
@@ -1,4 +1,3 @@
1
- from datetime import datetime, date
2
1
  from objict import objict
3
2
  from django.db import models as dm
4
3
  import string
@@ -6,6 +5,7 @@ import string
6
5
  from rest import helpers as rh
7
6
  from rest import errors as re
8
7
  from rest.encryption import ENCRYPTER, DECRYPTER
8
+ from datetime import datetime, date
9
9
 
10
10
 
11
11
  class MetaDataBase(dm.Model):
taskqueue/models.py CHANGED
@@ -90,6 +90,7 @@ class Task(models.Model, RestModel):
90
90
  'cancel_requested',
91
91
  'state',
92
92
  'runtime',
93
+ 'current_runtime',
93
94
  'channel',
94
95
  'model',
95
96
  'attempts',