ecodev-core 0.0.55__py3-none-any.whl → 0.0.57__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
@@ -19,6 +19,7 @@ from ecodev_core.authentication import get_current_user
19
19
  from ecodev_core.authentication import get_user
20
20
  from ecodev_core.authentication import is_admin_user
21
21
  from ecodev_core.authentication import is_authorized_user
22
+ from ecodev_core.authentication import is_banned
22
23
  from ecodev_core.authentication import is_monitoring_user
23
24
  from ecodev_core.authentication import JwtAuth
24
25
  from ecodev_core.authentication import safe_get_user
@@ -110,4 +111,4 @@ __all__ = [
110
111
  'sort_by_keys', 'sort_by_values', 'Settings', 'load_yaml_file', 'Deployment', 'Version',
111
112
  'sfield', 'field', 'upsert_df_data', 'upsert_deletor', 'get_row_versions', 'get_versions',
112
113
  'db_to_value', 'upsert_data', 'upsert_selector', 'get_sfield_columns', 'filter_to_sfield_dict',
113
- 'SETTINGS', 'add_missing_enum_values', 'ban_token', 'TokenBanlist']
114
+ '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
 
@@ -36,7 +36,7 @@ _PASSWORD = quote(SETTINGS_DB.db_password or DB.db_password, safe='')
36
36
  _USER, _HOST = SETTINGS_DB.db_username or DB.db_username, SETTINGS_DB.db_host or DB.db_host
37
37
  _PORT, _NAME = SETTINGS_DB.db_port or DB.db_port, SETTINGS_DB.db_name or DB.db_name
38
38
  DB_URL = f'postgresql://{_USER}:{_PASSWORD}@{_HOST}:{_PORT}/{_NAME}'
39
- engine = create_engine(DB_URL)
39
+ engine = create_engine(DB_URL, pool_pre_ping=True)
40
40
 
41
41
 
42
42
  def create_db_and_tables(model: Callable, excluded_tables: Optional[List[str]] = None) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ecodev-core
3
- Version: 0.0.55
3
+ Version: 0.0.57
4
4
  Summary: Low level sqlmodel/fastapi/pydantic building blocks
5
5
  License: MIT
6
6
  Author: Thomas Epelbaum
@@ -1,13 +1,13 @@
1
- ecodev_core/__init__.py,sha256=xS1h7Xtp-LBGeKkxFfJFqyxeBiznow7c1MPNAeYLtOg,6218
1
+ ecodev_core/__init__.py,sha256=K3mOMR75omZcvKBb_ki2upUZ2VjntJFXUoGZdOzUHJQ,6280
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
10
- ecodev_core/db_connection.py,sha256=hhqeyTrl0DlQA7RkUs6pIOpZeE3yS_Q5mqj5uGPfG_Y,2569
10
+ ecodev_core/db_connection.py,sha256=scur99ohLM4Mt931-1RAQh8b6YqFyyMMFkzz8eCxdik,2589
11
11
  ecodev_core/db_filters.py,sha256=T_5JVF27UEu7sC6NOm7-W3_Y0GLfbWQO_EeTXcD2cv8,5041
12
12
  ecodev_core/db_insertion.py,sha256=k-r798MMrW1sRb-gb8lQTxyJrb4QP5iZT8GDzCYYwlo,4544
13
13
  ecodev_core/db_retrieval.py,sha256=sCP7TDGIcTOK5gT3Inga91bE4S31HbQPw4yI22WJbss,7392
@@ -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.55.dist-info/LICENSE.md,sha256=8dqVJEbwXjPWjjRKjdLMym5k9Gi8hwtrHh84sti6KIs,1068
31
- ecodev_core-0.0.55.dist-info/METADATA,sha256=JBynrhYq46elNowZb9yfgMTyjedizyKOpiLyGqLhEp8,3510
32
- ecodev_core-0.0.55.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
33
- ecodev_core-0.0.55.dist-info/RECORD,,
30
+ ecodev_core-0.0.57.dist-info/LICENSE.md,sha256=8dqVJEbwXjPWjjRKjdLMym5k9Gi8hwtrHh84sti6KIs,1068
31
+ ecodev_core-0.0.57.dist-info/METADATA,sha256=xMi1SiUT_urXt1X8WSGnXgbaYgeVG00DvzBjqrLgfCc,3510
32
+ ecodev_core-0.0.57.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
33
+ ecodev_core-0.0.57.dist-info/RECORD,,