ecodev-core 0.0.3__py3-none-any.whl → 0.0.4__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 +2 -2
- ecodev_core/authentication.py +10 -0
- ecodev_core/db_insertion.py +1 -1
- {ecodev_core-0.0.3.dist-info → ecodev_core-0.0.4.dist-info}/LICENSE.md +1 -1
- {ecodev_core-0.0.3.dist-info → ecodev_core-0.0.4.dist-info}/METADATA +5 -1
- {ecodev_core-0.0.3.dist-info → ecodev_core-0.0.4.dist-info}/RECORD +7 -7
- {ecodev_core-0.0.3.dist-info → ecodev_core-0.0.4.dist-info}/WHEEL +0 -0
ecodev_core/__init__.py
CHANGED
|
@@ -20,6 +20,7 @@ from ecodev_core.authentication import is_admin_user
|
|
|
20
20
|
from ecodev_core.authentication import is_authorized_user
|
|
21
21
|
from ecodev_core.authentication import is_monitoring_user
|
|
22
22
|
from ecodev_core.authentication import JwtAuth
|
|
23
|
+
from ecodev_core.authentication import safe_get_user
|
|
23
24
|
from ecodev_core.authentication import SCHEME
|
|
24
25
|
from ecodev_core.authentication import Token
|
|
25
26
|
from ecodev_core.check_dependencies import check_dependencies
|
|
@@ -75,5 +76,4 @@ __all__ = [
|
|
|
75
76
|
'enum_converter', 'ServerSideFilter', 'get_rows', 'count_rows', 'ServerSideField', 'get_raw_df',
|
|
76
77
|
'generic_insertion', 'custom_equal', 'is_authorized_user', 'get_method', 'AppActivity',
|
|
77
78
|
'fastapi_monitor', 'dash_monitor', 'is_monitoring_user', 'get_recent_activities', 'select_user',
|
|
78
|
-
'get_access_token'
|
|
79
|
-
]
|
|
79
|
+
'get_access_token', 'safe_get_user']
|
ecodev_core/authentication.py
CHANGED
|
@@ -148,6 +148,16 @@ def is_authorized_user(token: str = Depends(SCHEME)) -> bool:
|
|
|
148
148
|
return False
|
|
149
149
|
|
|
150
150
|
|
|
151
|
+
def safe_get_user(token: Dict) -> Union[AppUser, None]:
|
|
152
|
+
"""
|
|
153
|
+
Safe method returning a user if one found given the passed token
|
|
154
|
+
"""
|
|
155
|
+
try:
|
|
156
|
+
return get_user(get_access_token(token))
|
|
157
|
+
except (HTTPException, AttributeError):
|
|
158
|
+
return None
|
|
159
|
+
|
|
160
|
+
|
|
151
161
|
def get_user(token: str = Depends(SCHEME)) -> AppUser:
|
|
152
162
|
"""
|
|
153
163
|
Retrieves (if it exists) the db user corresponding to the passed token
|
ecodev_core/db_insertion.py
CHANGED
|
@@ -37,7 +37,7 @@ class Insertor(CustomFrozen):
|
|
|
37
37
|
- selector: the criteria on which to decide whether to create or update (example: only add
|
|
38
38
|
a user if a user with the same name is not already present in the db)
|
|
39
39
|
- convertor: how to convert the raw csv/excel passed by the user to json like db rows
|
|
40
|
-
- whether to insert data based on an xlsx (if true) or a csv (if false)
|
|
40
|
+
- read_excel_file: whether to insert data based on an xlsx (if true) or a csv (if false)
|
|
41
41
|
"""
|
|
42
42
|
reductor: Callable[[Any, Any], Any]
|
|
43
43
|
db_schema: Callable
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright 2024 Thomas EPELBAUM
|
|
1
|
+
Copyright 2024 Thomas EPELBAUM for EcoAct
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction,
|
|
4
4
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ecodev-core
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Low level sqlmodel/fastapi/pydantic building blocks
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Thomas Epelbaum
|
|
@@ -71,3 +71,7 @@ Starting from a project with a Docker file:
|
|
|
71
71
|
* build the new version of the Docker container (typically `docker build --tag xxx .`)
|
|
72
72
|
* run it with docker compose (`dc up -d`).
|
|
73
73
|
|
|
74
|
+
## Documentation
|
|
75
|
+
|
|
76
|
+
Please find it in the [associated mkdoc website!](https://ecodev-doc.lcabox.com/)
|
|
77
|
+
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
ecodev_core/__init__.py,sha256=
|
|
1
|
+
ecodev_core/__init__.py,sha256=QFjRsg-gFBOBdRuTrqzhWEr7QnfKN88gW1KbbJXRjS8,4197
|
|
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=qXvu0GOm2fAY_KxjkPEUIw7Rb9uxm2kvyFvcTTBQvEg,2949
|
|
5
5
|
ecodev_core/auth_configuration.py,sha256=ZjEB-N5HTo2jaEljwrh6q64Lh5qZ1NuKk8bbpIEcdYc,433
|
|
6
|
-
ecodev_core/authentication.py,sha256=
|
|
6
|
+
ecodev_core/authentication.py,sha256=aujpCPzHLG2aHIREcJHdoWX9qnre5Gpz-tluqkFWfoo,7900
|
|
7
7
|
ecodev_core/check_dependencies.py,sha256=aFn8GI4eBbuJT8RxsfhSSnlpNYYj_LPOH-tZF0EqfKQ,6917
|
|
8
8
|
ecodev_core/custom_equal.py,sha256=2gRn0qpyJ8-Kw9GQSueu0nLngLrRrwyMPlP6zqPac0U,899
|
|
9
9
|
ecodev_core/db_connection.py,sha256=aEVndTo6U2xVczK3t6s_XL5mYfEaYeKb6v8u53nDI28,1704
|
|
10
10
|
ecodev_core/db_filters.py,sha256=T_5JVF27UEu7sC6NOm7-W3_Y0GLfbWQO_EeTXcD2cv8,5041
|
|
11
|
-
ecodev_core/db_insertion.py,sha256=
|
|
11
|
+
ecodev_core/db_insertion.py,sha256=RSCyAlUObbBlWJuMRX-YFY4VgtWqYLdwRqMWw--x95Y,3646
|
|
12
12
|
ecodev_core/db_retrieval.py,sha256=IxyF3ZtKgACLiNFggK7boKggvMRKYDRD2IimxU4dap4,7345
|
|
13
13
|
ecodev_core/enum_utils.py,sha256=BkQ4YQ97tXBYmMcQiSIi0mbioD5CgVU79myg1BBAXuA,556
|
|
14
14
|
ecodev_core/list_utils.py,sha256=z6jdXR7dRL1djaWWlTKmUfSVH60VHUwlM1FC3clO100,2364
|
|
@@ -18,7 +18,7 @@ ecodev_core/permissions.py,sha256=dMaRQyjrF8Y51gkbkFvFsGVdzQGLZtA72IQ7REYamxg,32
|
|
|
18
18
|
ecodev_core/pydantic_utils.py,sha256=e3GH50JmcpTmd2UgrB94QSwWOlOCW3WIlVdyX9C4T-U,741
|
|
19
19
|
ecodev_core/read_write.py,sha256=auJ5bBJTVGkLRkiP_vZxVCX64B0Y-9qpsaDhovHmbas,996
|
|
20
20
|
ecodev_core/safe_utils.py,sha256=uTHzLnKBoV_MiFsI65X-WYmgzLpIBH5Cio80KSLd6wg,5933
|
|
21
|
-
ecodev_core-0.0.
|
|
22
|
-
ecodev_core-0.0.
|
|
23
|
-
ecodev_core-0.0.
|
|
24
|
-
ecodev_core-0.0.
|
|
21
|
+
ecodev_core-0.0.4.dist-info/LICENSE.md,sha256=jebQDe1ib9LAODuNvcSoo2CoqS6P0_q8--mMTICh_kI,1074
|
|
22
|
+
ecodev_core-0.0.4.dist-info/METADATA,sha256=Ii6KPPd5-VlN0GhFFVcp7-WfABksq667787e4EOXT6o,3217
|
|
23
|
+
ecodev_core-0.0.4.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
24
|
+
ecodev_core-0.0.4.dist-info/RECORD,,
|
|
File without changes
|