nlbone 0.7.1__py3-none-any.whl → 0.7.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.
- nlbone/interfaces/api/dependencies/auth.py +10 -0
- {nlbone-0.7.1.dist-info → nlbone-0.7.2.dist-info}/METADATA +1 -1
- {nlbone-0.7.1.dist-info → nlbone-0.7.2.dist-info}/RECORD +6 -6
- {nlbone-0.7.1.dist-info → nlbone-0.7.2.dist-info}/WHEEL +0 -0
- {nlbone-0.7.1.dist-info → nlbone-0.7.2.dist-info}/entry_points.txt +0 -0
- {nlbone-0.7.1.dist-info → nlbone-0.7.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,9 +2,15 @@ import functools
|
|
|
2
2
|
|
|
3
3
|
from nlbone.adapters.auth import KeycloakAuthService
|
|
4
4
|
from nlbone.adapters.auth.keycloak import get_auth_service
|
|
5
|
+
from nlbone.config.settings import get_settings
|
|
5
6
|
from nlbone.interfaces.api.exceptions import ForbiddenException, UnauthorizedException
|
|
6
7
|
from nlbone.utils.context import current_request
|
|
7
8
|
|
|
9
|
+
@functools.lru_cache()
|
|
10
|
+
def bypass_authz() -> bool:
|
|
11
|
+
if get_settings().ENV != 'prod':
|
|
12
|
+
return True
|
|
13
|
+
return False
|
|
8
14
|
|
|
9
15
|
def current_user_id() -> int:
|
|
10
16
|
user_id = current_request().state.user_id
|
|
@@ -50,6 +56,8 @@ def user_authenticated(func):
|
|
|
50
56
|
|
|
51
57
|
|
|
52
58
|
def user_has_access_func(*, permissions=None):
|
|
59
|
+
if bypass_authz():
|
|
60
|
+
return
|
|
53
61
|
request = current_request()
|
|
54
62
|
if not current_user_id():
|
|
55
63
|
raise UnauthorizedException()
|
|
@@ -73,6 +81,8 @@ def has_access(*, permissions=None):
|
|
|
73
81
|
|
|
74
82
|
|
|
75
83
|
def client_or_user_has_access_func(permissions=None, client_permissions=None):
|
|
84
|
+
if bypass_authz():
|
|
85
|
+
return
|
|
76
86
|
request = current_request()
|
|
77
87
|
token = getattr(request.state, "token", None)
|
|
78
88
|
if not token:
|
|
@@ -74,7 +74,7 @@ nlbone/interfaces/api/additional_filed/default_field_rules/__init__.py,sha256=LU
|
|
|
74
74
|
nlbone/interfaces/api/additional_filed/default_field_rules/image_field_rules.py,sha256=ecKqPeXZ-YiF14RK9PmK7ln3PCzpCUc18S5zm5IF3fw,339
|
|
75
75
|
nlbone/interfaces/api/dependencies/__init__.py,sha256=rnYRrFVZCfICQrp_PVFlzNg3BeC57yM08wn2DbOHCfk,359
|
|
76
76
|
nlbone/interfaces/api/dependencies/async_auth.py,sha256=bfxgBXhp29WqevjTG4jrdPNR-75APm4jKyHdOOtxnp4,1825
|
|
77
|
-
nlbone/interfaces/api/dependencies/auth.py,sha256=
|
|
77
|
+
nlbone/interfaces/api/dependencies/auth.py,sha256=dKq3TIJN4CqKZcRIlMV3rz3v8sFgh9Rz_slIP2VNcvs,3083
|
|
78
78
|
nlbone/interfaces/api/dependencies/db.py,sha256=-UD39J_86UU7ZJs2ZncpdND0yhAG0NeeeALrgSDuuFw,466
|
|
79
79
|
nlbone/interfaces/api/dependencies/uow.py,sha256=QfLEvLYLNWZJQN1k-0q0hBVtUld3D75P4j39q_RjcnE,1181
|
|
80
80
|
nlbone/interfaces/api/middleware/__init__.py,sha256=zbX2vaEAfxRMIYwO2MVY_2O6bqG5H9o7HqGpX14U3Is,158
|
|
@@ -104,8 +104,8 @@ nlbone/utils/http.py,sha256=UXUoXgQdTRNT08ho8zl-C5ekfDsD8uf-JiMQ323ooqw,872
|
|
|
104
104
|
nlbone/utils/normalize_mobile.py,sha256=sGH4tV9gX-6eVKozviNWJhm1DN1J28Nj-ERldCYkS_E,732
|
|
105
105
|
nlbone/utils/redactor.py,sha256=-V4HrHmHwPi3Kez587Ek1uJlgK35qGSrwBOvcbw8Jas,1279
|
|
106
106
|
nlbone/utils/time.py,sha256=DjjyQ9GLsfXoT6NK8RDW2rOlJg3e6sF04Jw6PBUrSvg,1268
|
|
107
|
-
nlbone-0.7.
|
|
108
|
-
nlbone-0.7.
|
|
109
|
-
nlbone-0.7.
|
|
110
|
-
nlbone-0.7.
|
|
111
|
-
nlbone-0.7.
|
|
107
|
+
nlbone-0.7.2.dist-info/METADATA,sha256=KqXtF5AV-X4TaqT1Gouy9CUMa0JZAy0R2fq5a6zeBeA,2294
|
|
108
|
+
nlbone-0.7.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
109
|
+
nlbone-0.7.2.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
|
|
110
|
+
nlbone-0.7.2.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
111
|
+
nlbone-0.7.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|