nlbone 0.9.5__py3-none-any.whl → 0.9.7__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.
@@ -9,8 +9,8 @@ from nlbone.config.settings import get_settings
9
9
  class CreateTicketIn(BaseModel):
10
10
  assignee_id: str | None = None
11
11
  category_id: int
12
- channel: str
13
- direction: str
12
+ channel: str | None = None
13
+ direction: str | None = None
14
14
  entity_id: str
15
15
  entity_type: str
16
16
  message: str
@@ -19,6 +19,9 @@ class CreateTicketIn(BaseModel):
19
19
  status: str
20
20
  title: str
21
21
  user_id: int
22
+ order_item_id: str
23
+ product_variant_id: str
24
+ type: str
22
25
 
23
26
 
24
27
  class TicketingClient:
@@ -111,3 +111,22 @@ def client_or_user_has_access(*, permissions=None, client_permissions=None):
111
111
  return wrapper
112
112
 
113
113
  return decorator
114
+
115
+
116
+ def is_permitted_user(permissions=None):
117
+ def check_permissions():
118
+ try:
119
+ if bypass_authz():
120
+ return True
121
+ request = current_request()
122
+ if not current_user_id():
123
+ raise UnauthorizedException()
124
+ if not get_auth_service().has_access(request.state.token, permissions=permissions):
125
+ raise ForbiddenException(f"Forbidden {permissions}")
126
+ return True
127
+ except ForbiddenException:
128
+ return False
129
+ except UnauthorizedException:
130
+ return False
131
+
132
+ return check_permissions
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nlbone
3
- Version: 0.9.5
3
+ Version: 0.9.7
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
@@ -44,7 +44,7 @@ nlbone/adapters/percolation/__init__.py,sha256=0h1Bw7FzxgkDIHxeoyQXSfegrhP6VbpYV
44
44
  nlbone/adapters/percolation/connection.py,sha256=1iJISSwMEh4r_6nJI7mYf_v64Q0eeU1eSI0wLIfOK14,415
45
45
  nlbone/adapters/repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  nlbone/adapters/ticketing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
- nlbone/adapters/ticketing/client.py,sha256=J1-eT3qQDAJqrHcVpP1oqWNsRNnJ54dDdBeez-m9wyY,1291
47
+ nlbone/adapters/ticketing/client.py,sha256=b9U3ouK8sIVq1A_1Z6PgAEaT0_-a3PIP7DvRv-WaoAU,1384
48
48
  nlbone/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
49
  nlbone/config/logging.py,sha256=Ot6Ctf7EQZlW8YNB-uBdleqI6wixn5fH0Eo6QRgNkQk,4358
50
50
  nlbone/config/settings.py,sha256=4OLG9M9wB5H6slNcg61NuNEPoWQsjoA6RvesRYa1C7c,5330
@@ -82,7 +82,7 @@ nlbone/interfaces/api/additional_filed/default_field_rules/__init__.py,sha256=LU
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
84
  nlbone/interfaces/api/dependencies/async_auth.py,sha256=TZlFzT-mnPz1WBL0wh3nOlBXDjY-7B0-b4wBT8O6pLM,1890
85
- nlbone/interfaces/api/dependencies/auth.py,sha256=H7xsvYfcnrgBR4mjhyMnfAMRHFf4QC18vAQ_c52rJUI,3200
85
+ nlbone/interfaces/api/dependencies/auth.py,sha256=59oBL3FyRl0mCr0qaRKOCuY5kH5QkZekdbMr8hNOOGQ,3810
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
@@ -116,8 +116,8 @@ nlbone/utils/normalize_mobile.py,sha256=sGH4tV9gX-6eVKozviNWJhm1DN1J28Nj-ERldCYk
116
116
  nlbone/utils/read_files.py,sha256=mx8dfvtaaARQFRp_U7OOiERg-GT62h09_lpTzIQsVhs,291
117
117
  nlbone/utils/redactor.py,sha256=-V4HrHmHwPi3Kez587Ek1uJlgK35qGSrwBOvcbw8Jas,1279
118
118
  nlbone/utils/time.py,sha256=DjjyQ9GLsfXoT6NK8RDW2rOlJg3e6sF04Jw6PBUrSvg,1268
119
- nlbone-0.9.5.dist-info/METADATA,sha256=lc5St2IMS1hkjpvAtPsrJWihPiUUD4NFS5V2y3ntg74,2294
120
- nlbone-0.9.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
121
- nlbone-0.9.5.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
122
- nlbone-0.9.5.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
- nlbone-0.9.5.dist-info/RECORD,,
119
+ nlbone-0.9.7.dist-info/METADATA,sha256=SAtWlKKfb4Hnfmgr4tRsiryWZSNr7DWjJAbIZOnpfmE,2294
120
+ nlbone-0.9.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
121
+ nlbone-0.9.7.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
122
+ nlbone-0.9.7.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
+ nlbone-0.9.7.dist-info/RECORD,,
File without changes