ecodev-core 0.0.24__py3-none-any.whl → 0.0.26__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
@@ -51,6 +51,7 @@ from ecodev_core.logger import log_critical
51
51
  from ecodev_core.logger import logger_get
52
52
  from ecodev_core.pandas_utils import get_excelfile
53
53
  from ecodev_core.pandas_utils import get_value
54
+ from ecodev_core.pandas_utils import is_null
54
55
  from ecodev_core.pandas_utils import jsonify_series
55
56
  from ecodev_core.pandas_utils import pd_equals
56
57
  from ecodev_core.pandas_utils import safe_drop_columns
@@ -83,4 +84,4 @@ __all__ = [
83
84
  'generic_insertion', 'custom_equal', 'is_authorized_user', 'get_method', 'AppActivity',
84
85
  'fastapi_monitor', 'dash_monitor', 'is_monitoring_user', 'get_recent_activities', 'select_user',
85
86
  'get_access_token', 'safe_get_user', 'backup', 'group_by', 'get_excelfile', 'upsert_new_user',
86
- 'datify', 'safe_drop_columns', 'get_value']
87
+ 'datify', 'safe_drop_columns', 'get_value', 'is_null']
@@ -152,14 +152,12 @@ def attempt_to_log(user: str,
152
152
  'token_type': 'bearer'}
153
153
 
154
154
 
155
- def is_authorized_user(token: str = Depends(SCHEME),
156
- tfa_value: Optional[str] = None,
157
- tfa_check: bool = False) -> bool:
155
+ def is_authorized_user(token: str = Depends(SCHEME)) -> bool:
158
156
  """
159
157
  Check if the passed token corresponds to an authorized user
160
158
  """
161
159
  try:
162
- return get_current_user(token, tfa_value, tfa_check) is not None
160
+ return get_current_user(token) is not None
163
161
  except Exception:
164
162
  return False
165
163
 
@@ -198,14 +196,11 @@ def get_current_user(token: str,
198
196
  return session.exec(select(AppUser).where(col(AppUser.id) == token.id)).first()
199
197
 
200
198
 
201
- def is_admin_user(token: str = Depends(SCHEME),
202
- tfa_value: Optional[str] = None,
203
- tfa_check: bool = False) -> AppUser:
199
+ def is_admin_user(token: str = Depends(SCHEME)) -> AppUser:
204
200
  """
205
201
  Retrieves (if it exists) the admin (meaning who has valid credentials) user from the db
206
202
  """
207
- if (user := get_current_user(
208
- token, tfa_value, tfa_check)) and user.permission == Permission.ADMIN:
203
+ if (user := get_current_user(token)) and user.permission == Permission.ADMIN:
209
204
  return user
210
205
  raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=ADMIN_ERROR,
211
206
  headers={'WWW-Authenticate': 'Bearer'})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ecodev-core
3
- Version: 0.0.24
3
+ Version: 0.0.26
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=LS-nx8cHTL31GXmG1wuSG7nUeukxwuNkWOgLX2nLEW8,4634
1
+ ecodev_core/__init__.py,sha256=JVtBxh-CIZQODjq4tHhl3o1qK1DqMJQsbtlFXjXBuYY,4690
2
2
  ecodev_core/app_activity.py,sha256=_rU5uPfttHxXX5IaCuTA7K9We5w2qluJ3Xpf6i12HhY,3763
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=ZjEB-N5HTo2jaEljwrh6q64Lh5qZ1NuKk8bbpIEcdYc,433
6
- ecodev_core/authentication.py,sha256=XL_hPRw_jd1jFxASFmxB1GJqCeg8zY8S8GFt2Y1XoGE,10278
6
+ ecodev_core/authentication.py,sha256=aLMk2_fn1Fodrby2ywZraB3JTSsSrPsBiQq0ag0ySiY,10023
7
7
  ecodev_core/backup.py,sha256=8fwBHic6hE8swNESIayZqqWZFHFz5f-puBWSt5f_ZLw,3119
8
8
  ecodev_core/check_dependencies.py,sha256=aFn8GI4eBbuJT8RxsfhSSnlpNYYj_LPOH-tZF0EqfKQ,6917
9
9
  ecodev_core/custom_equal.py,sha256=2gRn0qpyJ8-Kw9GQSueu0nLngLrRrwyMPlP6zqPac0U,899
@@ -19,7 +19,7 @@ ecodev_core/permissions.py,sha256=WAx-ilMu8LlQp2sjJVdkhNQieytEaEm8577ZF1HWeTY,50
19
19
  ecodev_core/pydantic_utils.py,sha256=e3GH50JmcpTmd2UgrB94QSwWOlOCW3WIlVdyX9C4T-U,741
20
20
  ecodev_core/read_write.py,sha256=auJ5bBJTVGkLRkiP_vZxVCX64B0Y-9qpsaDhovHmbas,996
21
21
  ecodev_core/safe_utils.py,sha256=JCfxo6fcznjsL-XHNJ1TKo1UvfJB83WT5jpTFmtJwsE,6160
22
- ecodev_core-0.0.24.dist-info/LICENSE.md,sha256=jebQDe1ib9LAODuNvcSoo2CoqS6P0_q8--mMTICh_kI,1074
23
- ecodev_core-0.0.24.dist-info/METADATA,sha256=648Xgoc989SaclZo3RmYN1OHB_rYhNEXjfwJFUv6gw4,3276
24
- ecodev_core-0.0.24.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
25
- ecodev_core-0.0.24.dist-info/RECORD,,
22
+ ecodev_core-0.0.26.dist-info/LICENSE.md,sha256=jebQDe1ib9LAODuNvcSoo2CoqS6P0_q8--mMTICh_kI,1074
23
+ ecodev_core-0.0.26.dist-info/METADATA,sha256=uBVogQUbridd3IvVfepy8spgLb-EHl_Osmo_Wde9Kfo,3276
24
+ ecodev_core-0.0.26.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
25
+ ecodev_core-0.0.26.dist-info/RECORD,,