ecodev-core 0.0.54__py3-none-any.whl → 0.0.56__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.

Potentially problematic release.


This version of ecodev-core might be problematic. Click here for more details.

ecodev_core/__init__.py CHANGED
@@ -11,7 +11,7 @@ from ecodev_core.app_user import AppUser
11
11
  from ecodev_core.app_user import select_user
12
12
  from ecodev_core.app_user import upsert_app_users
13
13
  from ecodev_core.auth_configuration import AUTH
14
- from ecodev_core.authentication import attempt_to_log
14
+ from ecodev_core.authentication import attempt_to_log, is_banned
15
15
  from ecodev_core.authentication import ban_token
16
16
  from ecodev_core.authentication import get_access_token
17
17
  from ecodev_core.authentication import get_app_services
@@ -110,4 +110,4 @@ __all__ = [
110
110
  'sort_by_keys', 'sort_by_values', 'Settings', 'load_yaml_file', 'Deployment', 'Version',
111
111
  'sfield', 'field', 'upsert_df_data', 'upsert_deletor', 'get_row_versions', 'get_versions',
112
112
  'db_to_value', 'upsert_data', 'upsert_selector', 'get_sfield_columns', 'filter_to_sfield_dict',
113
- 'SETTINGS', 'add_missing_enum_values', 'ban_token', 'TokenBanlist']
113
+ 'SETTINGS', 'add_missing_enum_values', 'ban_token', 'TokenBanlist', 'is_banned']
@@ -159,7 +159,7 @@ def is_authorized_user(token: str = Depends(SCHEME)) -> bool:
159
159
  """
160
160
  Check if the passed token corresponds to an authorized user
161
161
  """
162
- if _is_banned(token):
162
+ if is_banned(token):
163
163
  return False
164
164
 
165
165
  try:
@@ -184,7 +184,7 @@ def get_user(token: str = Depends(SCHEME),
184
184
  """
185
185
  Retrieves (if it exists) the db user corresponding to the passed token
186
186
  """
187
- if _is_banned(token):
187
+ if is_banned(token):
188
188
  raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=REVOKED_TOKEN,
189
189
  headers={'WWW-Authenticate': 'Bearer'})
190
190
  if user := get_current_user(token, tfa_value, tfa_check):
@@ -201,7 +201,7 @@ def ban_token(token: str, session: Session) -> None:
201
201
  session.commit()
202
202
 
203
203
 
204
- def _is_banned(token: str) -> bool:
204
+ def is_banned(token: str) -> bool:
205
205
  """
206
206
  Check if the passed token is banned.
207
207
 
@@ -232,7 +232,7 @@ def is_admin_user(token: str = Depends(SCHEME)) -> AppUser:
232
232
  """
233
233
  Retrieves (if it exists) the admin (meaning who has valid credentials) user from the db
234
234
  """
235
- if _is_banned(token):
235
+ if is_banned(token):
236
236
  raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=REVOKED_TOKEN,
237
237
  headers={'WWW-Authenticate': 'Bearer'})
238
238
 
@@ -246,7 +246,7 @@ def is_monitoring_user(token: str = Depends(SCHEME)) -> AppUser:
246
246
  """
247
247
  Retrieves (if it exists) the monitoring user from the db
248
248
  """
249
- if _is_banned(token):
249
+ if is_banned(token):
250
250
  raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=REVOKED_TOKEN,
251
251
  headers={'WWW-Authenticate': 'Bearer'})
252
252
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ecodev-core
3
- Version: 0.0.54
3
+ Version: 0.0.56
4
4
  Summary: Low level sqlmodel/fastapi/pydantic building blocks
5
5
  License: MIT
6
6
  Author: Thomas Epelbaum
@@ -1,9 +1,9 @@
1
- ecodev_core/__init__.py,sha256=xS1h7Xtp-LBGeKkxFfJFqyxeBiznow7c1MPNAeYLtOg,6218
1
+ ecodev_core/__init__.py,sha256=gLcihMiMTLex9taJGTYL-BpmugfLUfhREqUJG4oHPio,6242
2
2
  ecodev_core/app_activity.py,sha256=KBtI-35LBLPDppFB7xjxWthXQrY3Z_aGDnC-HrW8Ea0,4641
3
3
  ecodev_core/app_rights.py,sha256=RZPdDtydFqc_nFj96huKAc56BS0qS6ScKv4Kghqd6lc,726
4
4
  ecodev_core/app_user.py,sha256=r1bqA4H08x53XmxmjwyGKl_PFjYQazzBbVErdkztqeE,2947
5
5
  ecodev_core/auth_configuration.py,sha256=qZ1Dkk7n1AH7w0tVKQ8AYswukOeMZH6mmbixPEAQnJ8,764
6
- ecodev_core/authentication.py,sha256=HuA8o_A_jjnTzG6NKqIeh5LP1tb0yyCR1RvXcPy2Xks,11559
6
+ ecodev_core/authentication.py,sha256=JJz_ezjCEBz_RGwFYyPzZHnM6pyk3rLOcKxkV5UESjA,11554
7
7
  ecodev_core/backup.py,sha256=N5AtoqtHJRp92Bj0Nr7WW5WDcpjTIET8haxZoYDOtyI,3890
8
8
  ecodev_core/check_dependencies.py,sha256=aFn8GI4eBbuJT8RxsfhSSnlpNYYj_LPOH-tZF0EqfKQ,6917
9
9
  ecodev_core/custom_equal.py,sha256=2gRn0qpyJ8-Kw9GQSueu0nLngLrRrwyMPlP6zqPac0U,899
@@ -27,7 +27,7 @@ ecodev_core/settings.py,sha256=UvaTv8S_HvfFAL-m1Rfqv_geSGcccuV3ziR1o1d5wu4,1795
27
27
  ecodev_core/sqlmodel_utils.py,sha256=t57H3QPtKRy4ujic1clMK_2L4p0yjGJLZbDjHPZ8M94,453
28
28
  ecodev_core/token_banlist.py,sha256=rKXG9QkfCpjOTr8gBgdX-KYNHAkKvQ9TRnGS99VC9Co,491
29
29
  ecodev_core/version.py,sha256=eyIf8KkW_t-hMuYFIoy0cUlNaMewLe6i45m2HKZKh0Q,4403
30
- ecodev_core-0.0.54.dist-info/LICENSE.md,sha256=8dqVJEbwXjPWjjRKjdLMym5k9Gi8hwtrHh84sti6KIs,1068
31
- ecodev_core-0.0.54.dist-info/METADATA,sha256=B7yPgikOYilTBVwdJs9VXdrdzONDc5JFXPX7cRoyYZI,3510
32
- ecodev_core-0.0.54.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
33
- ecodev_core-0.0.54.dist-info/RECORD,,
30
+ ecodev_core-0.0.56.dist-info/LICENSE.md,sha256=8dqVJEbwXjPWjjRKjdLMym5k9Gi8hwtrHh84sti6KIs,1068
31
+ ecodev_core-0.0.56.dist-info/METADATA,sha256=KlkOlHdFNFWIV7oMwCj6eFS4HmZogG0m7R2OsfqcT3c,3510
32
+ ecodev_core-0.0.56.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
33
+ ecodev_core-0.0.56.dist-info/RECORD,,