elody 0.0.222__tar.gz → 0.0.223__tar.gz

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.
Files changed (53) hide show
  1. {elody-0.0.222 → elody-0.0.223}/PKG-INFO +1 -1
  2. {elody-0.0.222 → elody-0.0.223}/pyproject.toml +1 -1
  3. {elody-0.0.222 → elody-0.0.223}/src/elody/object_configurations/elody_configuration.py +0 -12
  4. elody-0.0.223/src/elody/policies/authentication/x_user_headers_policy.py +34 -0
  5. {elody-0.0.222 → elody-0.0.223}/src/elody.egg-info/PKG-INFO +1 -1
  6. {elody-0.0.222 → elody-0.0.223}/src/elody.egg-info/SOURCES.txt +1 -0
  7. {elody-0.0.222 → elody-0.0.223}/LICENSE +0 -0
  8. {elody-0.0.222 → elody-0.0.223}/README.md +0 -0
  9. {elody-0.0.222 → elody-0.0.223}/setup.cfg +0 -0
  10. {elody-0.0.222 → elody-0.0.223}/src/__init__.py +0 -0
  11. {elody-0.0.222 → elody-0.0.223}/src/elody/__init__.py +0 -0
  12. {elody-0.0.222 → elody-0.0.223}/src/elody/client.py +0 -0
  13. {elody-0.0.222 → elody-0.0.223}/src/elody/csv.py +0 -0
  14. {elody-0.0.222 → elody-0.0.223}/src/elody/error_codes.py +0 -0
  15. {elody-0.0.222 → elody-0.0.223}/src/elody/exceptions.py +0 -0
  16. {elody-0.0.222 → elody-0.0.223}/src/elody/job.py +0 -0
  17. {elody-0.0.222 → elody-0.0.223}/src/elody/loader.py +0 -0
  18. {elody-0.0.222 → elody-0.0.223}/src/elody/migration/__init__.py +0 -0
  19. {elody-0.0.222 → elody-0.0.223}/src/elody/migration/base_object_migrator.py +0 -0
  20. {elody-0.0.222 → elody-0.0.223}/src/elody/object_configurations/__init__.py +0 -0
  21. {elody-0.0.222 → elody-0.0.223}/src/elody/object_configurations/base_object_configuration.py +0 -0
  22. {elody-0.0.222 → elody-0.0.223}/src/elody/object_configurations/job_configuration.py +0 -0
  23. {elody-0.0.222 → elody-0.0.223}/src/elody/object_configurations/saved_search_configuration.py +0 -0
  24. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/__init__.py +0 -0
  25. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authentication/__init__.py +0 -0
  26. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authentication/base_user_tenant_validation_policy.py +0 -0
  27. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authentication/multi_tenant_policy.py +0 -0
  28. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/__init__.py +0 -0
  29. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/filter_generic_objects_policy.py +0 -0
  30. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/filter_generic_objects_policy_v2.py +0 -0
  31. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/generic_object_detail_policy.py +0 -0
  32. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/generic_object_mediafiles_policy.py +0 -0
  33. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/generic_object_metadata_policy.py +0 -0
  34. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/generic_object_relations_policy.py +0 -0
  35. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/generic_object_request_policy.py +0 -0
  36. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/generic_object_request_policy_v2.py +0 -0
  37. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/mediafile_derivatives_policy.py +0 -0
  38. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/mediafile_download_policy.py +0 -0
  39. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/multi_tenant_policy.py +0 -0
  40. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/authorization/tenant_request_policy.py +0 -0
  41. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/helpers.py +0 -0
  42. {elody-0.0.222 → elody-0.0.223}/src/elody/policies/permission_handler.py +0 -0
  43. {elody-0.0.222 → elody-0.0.223}/src/elody/schemas.py +0 -0
  44. {elody-0.0.222 → elody-0.0.223}/src/elody/util.py +0 -0
  45. {elody-0.0.222 → elody-0.0.223}/src/elody/validator.py +0 -0
  46. {elody-0.0.222 → elody-0.0.223}/src/elody.egg-info/dependency_links.txt +0 -0
  47. {elody-0.0.222 → elody-0.0.223}/src/elody.egg-info/requires.txt +0 -0
  48. {elody-0.0.222 → elody-0.0.223}/src/elody.egg-info/top_level.txt +0 -0
  49. {elody-0.0.222 → elody-0.0.223}/src/tests/__init_.py +0 -0
  50. {elody-0.0.222 → elody-0.0.223}/src/tests/data.py +0 -0
  51. {elody-0.0.222 → elody-0.0.223}/src/tests/unit/__init__.py +0 -0
  52. {elody-0.0.222 → elody-0.0.223}/src/tests/unit/test_csv.py +0 -0
  53. {elody-0.0.222 → elody-0.0.223}/src/tests/unit/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elody
3
- Version: 0.0.222
3
+ Version: 0.0.223
4
4
  Summary: elody SDK for Python
5
5
  Author-email: Inuits <developers@inuits.eu>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "elody"
9
- version = "0.0.222"
9
+ version = "0.0.223"
10
10
  description = "elody SDK for Python"
11
11
  readme = "README.md"
12
12
  authors = [{ name = "Inuits", email = "developers@inuits.eu" }]
@@ -51,7 +51,6 @@ class ElodyConfiguration(BaseObjectConfiguration):
51
51
  post_body if isinstance(post_body, dict) else {},
52
52
  )
53
53
  _id = document_defaults.get("_id", str(uuid4()))
54
- timestamp = datetime.now(timezone.utc)
55
54
 
56
55
  identifiers = (
57
56
  post_body.pop("identifiers", []) if isinstance(post_body, dict) else []
@@ -87,17 +86,6 @@ class ElodyConfiguration(BaseObjectConfiguration):
87
86
  document = {**template, **document_defaults, **post_body}
88
87
  else:
89
88
  document = {**template, **document_defaults}
90
- document = self._pre_crud_hook(
91
- crud="create",
92
- timestamp=timestamp,
93
- document=document,
94
- audit_override={
95
- "date_created": document_defaults.get("date_created"),
96
- "created_by": document_defaults.get("created_by"),
97
- "date_updated": document_defaults.get("date_updated"),
98
- "last_editor": document_defaults.get("last_editor"),
99
- },
100
- )
101
89
  return document
102
90
 
103
91
  def _document_content_patcher(self, *, document, content, overwrite=False, **_):
@@ -0,0 +1,34 @@
1
+ from configuration import get_object_configuration_mapper
2
+ from flask import Request
3
+ from inuits_policy_based_auth.authentication.base_authentication_policy import (
4
+ BaseAuthenticationPolicy,
5
+ )
6
+ from os import getenv
7
+ from storage.storagemanager import StorageManager
8
+
9
+
10
+ class XUserHeadersPolicy(BaseAuthenticationPolicy):
11
+ def authenticate(self, user_context, request_context):
12
+ request: Request = request_context.http_request
13
+
14
+ auth_header = request.headers.get("Authorization", "")
15
+ if auth_header.startswith("Bearer "):
16
+ token = auth_header.removeprefix("Bearer ")
17
+ static_jwt = getenv("STATIC_JWT")
18
+
19
+ if static_jwt and token == static_jwt:
20
+ user_email = request.headers.get("X-User-Email")
21
+ if user_email:
22
+ config = get_object_configuration_mapper().get("user")
23
+ storage_manager = StorageManager()
24
+ user = (
25
+ storage_manager.get_db_engine().get_item_from_collection_by_id(
26
+ config.crud()["collection"], user_email
27
+ )
28
+ )
29
+
30
+ if user:
31
+ user_context.id = user.get("_id", user.get("id"))
32
+ user_context.email = user_email
33
+
34
+ return user_context
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elody
3
- Version: 0.0.222
3
+ Version: 0.0.223
4
4
  Summary: elody SDK for Python
5
5
  Author-email: Inuits <developers@inuits.eu>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -30,6 +30,7 @@ src/elody/policies/permission_handler.py
30
30
  src/elody/policies/authentication/__init__.py
31
31
  src/elody/policies/authentication/base_user_tenant_validation_policy.py
32
32
  src/elody/policies/authentication/multi_tenant_policy.py
33
+ src/elody/policies/authentication/x_user_headers_policy.py
33
34
  src/elody/policies/authorization/__init__.py
34
35
  src/elody/policies/authorization/filter_generic_objects_policy.py
35
36
  src/elody/policies/authorization/filter_generic_objects_policy_v2.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes