elody 0.0.225__tar.gz → 0.0.226__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.
- {elody-0.0.225 → elody-0.0.226}/PKG-INFO +1 -1
- {elody-0.0.225 → elody-0.0.226}/pyproject.toml +1 -1
- {elody-0.0.225 → elody-0.0.226}/src/elody/error_codes.py +1 -1
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/helpers.py +13 -2
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/permission_handler.py +12 -5
- {elody-0.0.225 → elody-0.0.226}/src/elody.egg-info/PKG-INFO +1 -1
- {elody-0.0.225 → elody-0.0.226}/LICENSE +0 -0
- {elody-0.0.225 → elody-0.0.226}/README.md +0 -0
- {elody-0.0.225 → elody-0.0.226}/setup.cfg +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/__init__.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/__init__.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/client.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/csv.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/exceptions.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/job.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/loader.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/migration/__init__.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/migration/base_object_migrator.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/object_configurations/__init__.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/object_configurations/base_object_configuration.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/object_configurations/elody_configuration.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/object_configurations/job_configuration.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/object_configurations/saved_search_configuration.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/__init__.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authentication/__init__.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authentication/base_user_tenant_validation_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authentication/multi_tenant_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authentication/x_user_headers_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/__init__.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/filter_generic_objects_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/filter_generic_objects_policy_v2.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_detail_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_mediafiles_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_metadata_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_relations_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_request_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_request_policy_v2.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/mediafile_derivatives_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/mediafile_download_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/multi_tenant_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/tenant_request_policy.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/schemas.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/util.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody/validator.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody.egg-info/SOURCES.txt +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody.egg-info/dependency_links.txt +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody.egg-info/requires.txt +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/elody.egg-info/top_level.txt +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/tests/__init_.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/tests/data.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/tests/unit/__init__.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/tests/unit/test_csv.py +0 -0
- {elody-0.0.225 → elody-0.0.226}/src/tests/unit/test_utils.py +0 -0
|
@@ -76,7 +76,7 @@ class ErrorCode(Enum):
|
|
|
76
76
|
INVALID_VALUE = ("5016", ["value", "options", "line_number"])
|
|
77
77
|
ITEM_WITH_VALUE_FOR_KEY_NOT_FOUND = ("5017", ["key", "value", "line_number"])
|
|
78
78
|
ITEM_WITH_VALUE_FOR_KEY_NOT_UNIQUE = ("5018", ["key", "value", "line_number"])
|
|
79
|
-
DUPLICATE_ENTRY_LINKED_ENTITIES = ("
|
|
79
|
+
DUPLICATE_ENTRY_LINKED_ENTITIES = ("5018", ["entity_type", "duplicate_entry"])
|
|
80
80
|
|
|
81
81
|
# Filter error codes
|
|
82
82
|
NO_MATCHER_FOR_FILTER_REQUEST = ("6001", [])
|
|
@@ -9,18 +9,18 @@ def generate_filter_key_and_lookup_from_restricted_key(key):
|
|
|
9
9
|
if (keys := key.split("@", 1)) and len(keys) == 1:
|
|
10
10
|
return key, {}
|
|
11
11
|
|
|
12
|
-
local_field = keys[0]
|
|
13
12
|
document_type, key = keys[1].split("-", 1)
|
|
14
13
|
collection = (
|
|
15
14
|
get_object_configuration_mapper().get(document_type).crud()["collection"]
|
|
16
15
|
)
|
|
16
|
+
local_field, lookup_prefix = parse_optional_filter_key(keys[0])
|
|
17
17
|
lookup = {
|
|
18
18
|
"from": collection,
|
|
19
19
|
"local_field": local_field,
|
|
20
20
|
"foreign_field": "identifiers",
|
|
21
21
|
"as": f"__lookup.virtual_relations.{document_type}",
|
|
22
22
|
}
|
|
23
|
-
return f"{lookup['as']}.{key}", lookup
|
|
23
|
+
return f"{lookup_prefix}{lookup['as']}.{key}", lookup
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
def get_content(item, request, content):
|
|
@@ -62,3 +62,14 @@ def get_item(storage_manager, user_context_bag, view_args) -> dict:
|
|
|
62
62
|
raise NotFound(
|
|
63
63
|
f"{get_error_code(ErrorCode.ITEM_NOT_FOUND, get_read())} | id:{id} - Item with id {id} does not exist."
|
|
64
64
|
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def parse_optional_filter_key(key):
|
|
68
|
+
prefix = ""
|
|
69
|
+
if key[0] == "!":
|
|
70
|
+
key = key[1:]
|
|
71
|
+
prefix += "!"
|
|
72
|
+
if key[0] == "?":
|
|
73
|
+
key = key[1:]
|
|
74
|
+
prefix += "?"
|
|
75
|
+
return key, prefix
|
|
@@ -4,9 +4,11 @@ from copy import deepcopy
|
|
|
4
4
|
from elody.error_codes import ErrorCode, get_error_code, get_read
|
|
5
5
|
from elody.policies.helpers import get_flat_item_and_object_lists, get_item
|
|
6
6
|
from elody.util import flatten_dict, interpret_flat_key
|
|
7
|
+
from flask import g
|
|
7
8
|
from inuits_policy_based_auth.contexts.user_context import UserContext
|
|
8
9
|
from logging_elody.log import log # pyright: ignore
|
|
9
10
|
from storage.storagemanager import StorageManager # pyright: ignore
|
|
11
|
+
from werkzeug.exceptions import NotFound
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
_permissions = {}
|
|
@@ -260,11 +262,16 @@ def __item_value_in_values(
|
|
|
260
262
|
if key_of_relation:
|
|
261
263
|
if isinstance(item_value, list):
|
|
262
264
|
item_value = item_value[0]
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
try:
|
|
266
|
+
item = get_item(
|
|
267
|
+
StorageManager(),
|
|
268
|
+
user_context.bag,
|
|
269
|
+
{"type": keys[1].split("-", 1)[0], "id": item_value},
|
|
270
|
+
)
|
|
271
|
+
except NotFound as exception:
|
|
272
|
+
if g.get("dry_run") or is_optional:
|
|
273
|
+
return True
|
|
274
|
+
raise exception
|
|
268
275
|
flat_item, _ = get_flat_item_and_object_lists(item)
|
|
269
276
|
return __item_value_in_values(
|
|
270
277
|
flat_item, key_of_relation, values, flat_request_body, user_context
|
|
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
|
{elody-0.0.225 → elody-0.0.226}/src/elody/object_configurations/base_object_configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/object_configurations/saved_search_configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/filter_generic_objects_policy.py
RENAMED
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/filter_generic_objects_policy_v2.py
RENAMED
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_detail_policy.py
RENAMED
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_mediafiles_policy.py
RENAMED
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_metadata_policy.py
RENAMED
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_relations_policy.py
RENAMED
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_request_policy.py
RENAMED
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/generic_object_request_policy_v2.py
RENAMED
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/mediafile_derivatives_policy.py
RENAMED
|
File without changes
|
{elody-0.0.225 → elody-0.0.226}/src/elody/policies/authorization/mediafile_download_policy.py
RENAMED
|
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
|