utg-base 1.19.0__py3-none-any.whl → 1.19.1__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.
@@ -7,6 +7,7 @@ from django_redis import get_redis_connection
7
7
  from redis.client import Redis
8
8
  from rest_framework.request import Request
9
9
 
10
+ from utg_base.constants import AccessibilityType
10
11
  from utg_base.env import env
11
12
  from utg_base.u_services import u_requests
12
13
  from utg_base.u_services.constants import UServices
@@ -19,7 +20,8 @@ def generate_perm_cache_key(user_id: str):
19
20
 
20
21
 
21
22
  def has_perm(user_id, perm, request=None):
22
- if request is not None and isinstance(request, Request) and request.user.is_superuser:
23
+ if (request is not None and isinstance(request, Request)
24
+ and (request.user.is_superuser or request.user.accessibility == AccessibilityType.ADMIN)):
23
25
  return True
24
26
  redis_conn: Redis = get_redis_connection("shared")
25
27
  perm = f"{to_snake_case(env('APP_NAME'))}:{perm}"
@@ -27,7 +29,8 @@ def has_perm(user_id, perm, request=None):
27
29
 
28
30
 
29
31
  def has_perms(user_id: str, perms: list[str], operator: Literal["OR", "AND"] = "OR", request=None):
30
- if request is not None and isinstance(request, Request) and request.user.is_superuser:
32
+ if (request is not None and isinstance(request, Request)
33
+ and (request.user.is_superuser or request.user.accessibility == AccessibilityType.ADMIN)):
31
34
  return True
32
35
  redis_conn: Redis = get_redis_connection("shared")
33
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.19.0
3
+ Version: 1.19.1
4
4
  Summary: UTG Base Package
5
5
  Author: Olimboy
6
6
  Author-email: shavkatov.olimboy@mail.ru
@@ -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=j1eaObNOKRgcpgvB3J8AAdXnXboGCMxKYu2l16itPp4,3043
45
+ utg_base/permissions/utils.py,sha256=ZoPlqVRmAQv8IS7AYWN1uEWj0CjTt_y5gy7A5hz2His,3238
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.19.0.dist-info/METADATA,sha256=6hNYr7nWeg335qTydKh6Hno89MFH2jMZFNwCmqa71Pw,960
73
- utg_base-1.19.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
74
- utg_base-1.19.0.dist-info/RECORD,,
72
+ utg_base-1.19.1.dist-info/METADATA,sha256=xgijhSRbBO6e5wcVUngfQLkNpB6-64mxZIcc9Q906OU,960
73
+ utg_base-1.19.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
74
+ utg_base-1.19.1.dist-info/RECORD,,