utg-base 1.20.0__py3-none-any.whl → 1.20.2__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.
@@ -53,4 +53,4 @@ class RelatedObjectField(serializers.PrimaryKeyRelatedField):
53
53
  return False
54
54
 
55
55
  def to_representation(self, value):
56
- return {f: str(getattr(value, f)) for f in self.fields}
56
+ return {field: getattr(value, field) for field in self.fields}
@@ -21,7 +21,7 @@ def generate_perm_cache_key(user_id: str):
21
21
 
22
22
  def has_perm(user_id, perm, request=None):
23
23
  if (request is not None and isinstance(request, Request)
24
- and (request.user.is_superuser or request.user.accessibility == AccessibilityType.ADMIN)):
24
+ and (request.user.is_superuser or safe_get(request, 'user.accessibility') == AccessibilityType.ADMIN)):
25
25
  return True
26
26
  redis_conn: Redis = get_redis_connection("shared")
27
27
  perm = f"{to_snake_case(env('APP_NAME'))}:{perm}"
@@ -30,7 +30,7 @@ def has_perm(user_id, perm, request=None):
30
30
 
31
31
  def has_perms(user_id: str, perms: list[str], operator: Literal["OR", "AND"] = "OR", request=None):
32
32
  if (request is not None and isinstance(request, Request)
33
- and (request.user.is_superuser or request.user.accessibility == AccessibilityType.ADMIN)):
33
+ and (request.user.is_superuser or safe_get(request, 'user.accessibility') == AccessibilityType.ADMIN)):
34
34
  return True
35
35
  redis_conn: Redis = get_redis_connection("shared")
36
36
  perms = [f"{to_snake_case(env('APP_NAME'))}:{perm}" for perm in perms]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: utg-base
3
- Version: 1.20.0
3
+ Version: 1.20.2
4
4
  Summary: UTG Base Package
5
5
  Author: Olimboy
6
6
  Author-email: shavkatov.olimboy@mail.ru
@@ -4,7 +4,7 @@ utg_base/api/base.py,sha256=giGKC68sL1j1NQbbkhIWzhHPcPlvjTPG2evra-xAJ3s,2574
4
4
  utg_base/api/pagination.py,sha256=zzIUwW3iF5G_11gFsno9y1DmgFiULQIWRHUj0LKhYfE,854
5
5
  utg_base/api/permissions.py,sha256=RjkxYWPl5Xwgk5lIZrcBzIAwlXolX5XPlae1jr-Ln2w,323
6
6
  utg_base/api/routers.py,sha256=lU54MVN2BF_q1AWp9EdXkG3m_ivYRtvbNGXFIRKz7u0,177
7
- utg_base/api/serializers.py,sha256=d3tfiIqgKk1TMe3GNXchZY0LWhjoFFZBRouT9kAhPlw,1668
7
+ utg_base/api/serializers.py,sha256=SGQgZtJ1mqLcguMqg7GeHR0V1Ml4-7zzp_FJLm7hsp0,1675
8
8
  utg_base/api/spectacular.py,sha256=W1G2c6Mw8OkTVwXHxJYzbadW9jykkkAn0C8tQu9gfuA,1047
9
9
  utg_base/authentications/__init__.py,sha256=a6twO_bBf8FAHYl7PXawfR2UbBwwdueG1uS_dbq2g_I,109
10
10
  utg_base/authentications/microservice_authentication.py,sha256=6aAncxIpA4FcyRegd7QqRYvW5Wn8FxyPU0nQqCVuEs4,976
@@ -42,7 +42,7 @@ utg_base/models/timestamp.py,sha256=AkCliNXnvs8Z17b1mcS7gOK7v6h3Jul6WCyGyVAkb-w,
42
42
  utg_base/permissions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  utg_base/permissions/decorators.py,sha256=g-ozzjkjJ-O69_wHWzZnZ9jitFR6MxqGLz2skFjzht4,2118
44
44
  utg_base/permissions/folder.py,sha256=uJv40FVb7R379qss66a5oUcLK7KCUIL6DPbzEcGOw38,694
45
- utg_base/permissions/utils.py,sha256=ZoPlqVRmAQv8IS7AYWN1uEWj0CjTt_y5gy7A5hz2His,3238
45
+ utg_base/permissions/utils.py,sha256=Rp8_ZuU5SdXri4amfFlMmrBoJUjwwQ4GYxDujRpt8YU,3264
46
46
  utg_base/references_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  utg_base/references_api/apps.py,sha256=thAGmO-ZT-OD9dHHBSQRL_RRt-Es_jt-mEmHgVTpERs,168
48
48
  utg_base/references_api/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -69,6 +69,6 @@ utg_base/utils/sql.py,sha256=rqIWcSjdjIMszdRnsnhV5TTYB8W17RPOujIQA9rKC_Y,762
69
69
  utg_base/utils/string.py,sha256=ATwIo9uLa00p85h_NjRYLcjRs8o3KSGF7s2yhTg5GiA,1073
70
70
  utg_base/utils/thread.py,sha256=4RqRnwtyHymY-dNcuPrMSTamE2V7wCMVfzzyIb0P4TI,2191
71
71
  utg_base/utils/translation.py,sha256=GxJHUt0iar_0E7RWBPbeLFQ4DhgXBjffHCmxfKyjFtk,463
72
- utg_base-1.20.0.dist-info/METADATA,sha256=hEV7vSsLKxTXrNiUqiPqS2orAqIEUpxFONpkbVxcZlc,960
73
- utg_base-1.20.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
74
- utg_base-1.20.0.dist-info/RECORD,,
72
+ utg_base-1.20.2.dist-info/METADATA,sha256=mP9vQ1VYY-_Wwlfv9rXqA13XWqaRzbn1A38BUjOAgNs,960
73
+ utg_base-1.20.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
74
+ utg_base-1.20.2.dist-info/RECORD,,