nlbone 0.9.5__py3-none-any.whl → 0.9.6__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.
@@ -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.6
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
@@ -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.6.dist-info/METADATA,sha256=grsf8ZTzLi3wWBAUyUGrEvmiLWIIbnhzf5Edzumd0FQ,2294
120
+ nlbone-0.9.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
121
+ nlbone-0.9.6.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
122
+ nlbone-0.9.6.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
+ nlbone-0.9.6.dist-info/RECORD,,
File without changes