nlbone 0.7.27__py3-none-any.whl → 0.7.29__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.
@@ -217,7 +217,7 @@ def _apply_filters(pagination, entity, query):
217
217
  if filters:
218
218
  for raw_field, value in filters.items():
219
219
  if value is None or value in NULL_SENTINELS or value == [] or value == {}:
220
- continue
220
+ value = None
221
221
 
222
222
  field, op_hint = _parse_field_and_op(raw_field)
223
223
  is_nested = "." in field
@@ -4,7 +4,7 @@ from nlbone.adapters.auth import KeycloakAuthService
4
4
  from nlbone.interfaces.api.exceptions import ForbiddenException, UnauthorizedException
5
5
  from nlbone.utils.context import current_request
6
6
 
7
- from .auth import client_has_access_func
7
+ from .auth import client_has_access_func, client_or_user_has_access_func
8
8
 
9
9
 
10
10
  async def current_user_id() -> int:
@@ -58,3 +58,15 @@ def has_access(*, permissions=None):
58
58
  return wrapper
59
59
 
60
60
  return decorator
61
+
62
+ def client_or_user_has_access(*, permissions=None, client_permissions=None):
63
+ def decorator(func):
64
+ @functools.wraps(func)
65
+ async def wrapper(*args, **kwargs):
66
+ client_or_user_has_access_func(permissions=permissions, client_permissions=client_permissions)
67
+ return await func(*args, **kwargs)
68
+
69
+ return wrapper
70
+
71
+ return decorator
72
+
@@ -45,7 +45,7 @@ class AddRequestContextMiddleware(BaseHTTPMiddleware):
45
45
  user_id = getattr(getattr(request, "state", None), "user_id", None) or request.headers.get("X-User-Id")
46
46
  ip = request.client.host if request.client else None
47
47
  ua = request.headers.get("user-agent")
48
- locale = request.headers.get("Accept-Language")
48
+ locale = request.headers.get("Accept-Language", 'fa-IR')
49
49
 
50
50
  tokens = bind_context(request=request, request_id=req_id, user_id=user_id, ip=ip, user_agent=ua, locale=locale)
51
51
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nlbone
3
- Version: 0.7.27
3
+ Version: 0.7.29
4
4
  Summary: Backbone package for interfaces and infrastructure in Python projects
5
5
  Author-email: Amir Hosein Kahkbazzadeh <a.khakbazzadeh@gmail.com>
6
6
  License: MIT
@@ -17,7 +17,7 @@ nlbone/adapters/db/postgres/__init__.py,sha256=tvCpHOdZbpQ57o7k-plq7L0e1uZe5_Frb
17
17
  nlbone/adapters/db/postgres/audit.py,sha256=IuWkPitr70UyQ6-GkAedckp8U-Z4cTgzFbdt_bQv1VQ,4800
18
18
  nlbone/adapters/db/postgres/base.py,sha256=I89PsEeR9ADEScG8D5pVSncPrPRBmf-KQQkjajl7Koo,132
19
19
  nlbone/adapters/db/postgres/engine.py,sha256=UCegauVB1gvo42ThytYnn5VIcQBwR-5xhcXYFApRFNk,3448
20
- nlbone/adapters/db/postgres/query_builder.py,sha256=-cFV6F34ZgbOP9J0oDp1k5KS_WgFoDgrrQJA3hlpPGk,15832
20
+ nlbone/adapters/db/postgres/query_builder.py,sha256=YSlrj7lEGI9RiJ__El5_4j7nCuFogg4pR0oVcBQ9h90,15836
21
21
  nlbone/adapters/db/postgres/repository.py,sha256=n01TAzdKd-UbOhirE6KMosuvRdJG2l1cszwVHjTM-Ks,10345
22
22
  nlbone/adapters/db/postgres/schema.py,sha256=NlE7Rr8uXypsw4oWkdZhZwcIBHQEPIpoHLxcUo98i6s,1039
23
23
  nlbone/adapters/db/postgres/types.py,sha256=0SVuIKokog6_ByrYUsYAoIypVM2-uKJhUTeDPtm0qhs,602
@@ -81,14 +81,14 @@ nlbone/interfaces/api/additional_filed/resolver.py,sha256=jv1TIBBHN4LBIMwHGipcy4
81
81
  nlbone/interfaces/api/additional_filed/default_field_rules/__init__.py,sha256=LUSAOO3xRUt5ptlraIx7H-7dSkdr1D-WprmnqXRB16g,48
82
82
  nlbone/interfaces/api/additional_filed/default_field_rules/image_field_rules.py,sha256=ecKqPeXZ-YiF14RK9PmK7ln3PCzpCUc18S5zm5IF3fw,339
83
83
  nlbone/interfaces/api/dependencies/__init__.py,sha256=rnYRrFVZCfICQrp_PVFlzNg3BeC57yM08wn2DbOHCfk,359
84
- nlbone/interfaces/api/dependencies/async_auth.py,sha256=s8qbMWuvHkS_9xnOmoO5kLLfKrZrOkvhKFfS9kQb51Y,1711
84
+ nlbone/interfaces/api/dependencies/async_auth.py,sha256=uQV36yk7s7SVsnwuA3eZ2NfqqVOe0vPFOSLuZcVsS8s,2122
85
85
  nlbone/interfaces/api/dependencies/auth.py,sha256=GGhXTUG0J_VHOjsQTBFpxHQV1OvT6RIGo2Jvj9IwQ6E,3310
86
86
  nlbone/interfaces/api/dependencies/client_credential.py,sha256=Bo4dYx75Qw0JzTKD9ZfV5EXDEOuwndJk2D-V37K2ePg,1293
87
87
  nlbone/interfaces/api/dependencies/db.py,sha256=-UD39J_86UU7ZJs2ZncpdND0yhAG0NeeeALrgSDuuFw,466
88
88
  nlbone/interfaces/api/dependencies/uow.py,sha256=QfLEvLYLNWZJQN1k-0q0hBVtUld3D75P4j39q_RjcnE,1181
89
89
  nlbone/interfaces/api/middleware/__init__.py,sha256=zbX2vaEAfxRMIYwO2MVY_2O6bqG5H9o7HqGpX14U3Is,158
90
90
  nlbone/interfaces/api/middleware/access_log.py,sha256=vIkxxxfy2HcjqqKb8XCfGCcSrivAC8u6ie75FMq5x-U,1032
91
- nlbone/interfaces/api/middleware/add_request_context.py,sha256=rfqbXvteFPzd8DLg3V_69fVR_kP-FSzezs91wb1DvPM,1905
91
+ nlbone/interfaces/api/middleware/add_request_context.py,sha256=rRxsE34XvsefN3HufZQyXqPFzCeWhdn3qel0-cS2QZM,1914
92
92
  nlbone/interfaces/api/middleware/authentication.py,sha256=Bt6sYu4KtXAyUQnSIp-Z2Z1yKNNtfRy9Y3rOZcYTFhw,3299
93
93
  nlbone/interfaces/api/pagination/__init__.py,sha256=pA1uC4rK6eqDI5IkLVxmgO2B6lExnOm8Pje2-hifJZw,431
94
94
  nlbone/interfaces/api/pagination/offset_base.py,sha256=60X8a9uDOSd3qG45M49dqNG_FUjSxEDrgEyb9JD9V-o,4113
@@ -114,8 +114,8 @@ nlbone/utils/http.py,sha256=0yeI34j5FfelqvX3PJnKknSXji1jl15VYbVIIvrSbXg,997
114
114
  nlbone/utils/normalize_mobile.py,sha256=sGH4tV9gX-6eVKozviNWJhm1DN1J28Nj-ERldCYkS_E,732
115
115
  nlbone/utils/redactor.py,sha256=-V4HrHmHwPi3Kez587Ek1uJlgK35qGSrwBOvcbw8Jas,1279
116
116
  nlbone/utils/time.py,sha256=DjjyQ9GLsfXoT6NK8RDW2rOlJg3e6sF04Jw6PBUrSvg,1268
117
- nlbone-0.7.27.dist-info/METADATA,sha256=SsvEG_znVKNmDDWIElrPipFoXoaswe4MeINGKg5PcwA,2295
118
- nlbone-0.7.27.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
119
- nlbone-0.7.27.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
120
- nlbone-0.7.27.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
121
- nlbone-0.7.27.dist-info/RECORD,,
117
+ nlbone-0.7.29.dist-info/METADATA,sha256=BjeBTqBMp4Ob1lqx8s8ihRQ5URDcY3e-P8sc5hTyaxY,2295
118
+ nlbone-0.7.29.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
119
+ nlbone-0.7.29.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
120
+ nlbone-0.7.29.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
121
+ nlbone-0.7.29.dist-info/RECORD,,