elody 0.0.196__py3-none-any.whl → 0.0.197__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.
elody/policies/helpers.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from configuration import get_object_configuration_mapper # pyright: ignore
2
2
  from elody.error_codes import ErrorCode, get_error_code, get_read
3
+ from elody.util import flatten_dict
3
4
  from serialization.serialize import serialize # pyright: ignore
4
5
  from werkzeug.exceptions import NotFound
5
6
 
@@ -33,6 +34,12 @@ def get_content(item, request, content):
33
34
  )
34
35
 
35
36
 
37
+ def get_flat_item_and_object_lists(item):
38
+ config = get_object_configuration_mapper().get(item["type"])
39
+ object_lists = config.document_info().get("object_lists", {})
40
+ return flatten_dict(object_lists, item), object_lists
41
+
42
+
36
43
  def get_item(storage_manager, user_context_bag, view_args) -> dict:
37
44
  view_args = view_args or {}
38
45
  if id := view_args.get("id"):
@@ -1,9 +1,8 @@
1
1
  import re as regex
2
2
 
3
- from configuration import get_object_configuration_mapper # pyright: ignore
4
3
  from copy import deepcopy
5
4
  from elody.error_codes import ErrorCode, get_error_code, get_read
6
- from elody.policies.helpers import get_item
5
+ from elody.policies.helpers import get_flat_item_and_object_lists, get_item
7
6
  from elody.util import flatten_dict, interpret_flat_key
8
7
  from inuits_policy_based_auth.contexts.user_context import UserContext
9
8
  from logging_elody.log import log # pyright: ignore
@@ -133,7 +132,7 @@ def __prepare_item_for_permission_check(item, permissions, crud):
133
132
  if item.get("type", "") not in permissions[crud].keys():
134
133
  return item, None, None, None
135
134
 
136
- flat_item, object_lists = __get_flat_item_and_object_lists(item)
135
+ flat_item, object_lists = get_flat_item_and_object_lists(item)
137
136
  return (
138
137
  item,
139
138
  flat_item,
@@ -265,7 +264,7 @@ def __item_value_in_values(
265
264
  if isinstance(item_value, list):
266
265
  item_value = item_value[0]
267
266
  item = get_item(StorageManager(), user_context.bag, {"id": item_value})
268
- flat_item, _ = __get_flat_item_and_object_lists(item)
267
+ flat_item, _ = get_flat_item_and_object_lists(item)
269
268
  return __item_value_in_values(
270
269
  flat_item, key_of_relation, values, flat_request_body, user_context
271
270
  )
@@ -300,9 +299,3 @@ def __get_element_from_object_list_of_item(
300
299
  if element[object_lists[object_list]] == key:
301
300
  return element
302
301
  return {}
303
-
304
-
305
- def __get_flat_item_and_object_lists(item):
306
- config = get_object_configuration_mapper().get(item["type"])
307
- object_lists = config.document_info().get("object_lists", {})
308
- return flatten_dict(object_lists, item), object_lists
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elody
3
- Version: 0.0.196
3
+ Version: 0.0.197
4
4
  Summary: elody SDK for Python
5
5
  Author-email: Inuits <developers@inuits.eu>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -16,8 +16,8 @@ elody/object_configurations/base_object_configuration.py,sha256=8wyUq_zqRkGb4Mp1
16
16
  elody/object_configurations/elody_configuration.py,sha256=H3iqNXPhYX6scR7C57L_hCWQH2MnWKwnH3vegLg-UGw,7645
17
17
  elody/object_configurations/job_configuration.py,sha256=HMDxaRUyfqhIy0q3yQDDMH9uW5iCd7VCmqknQofXNt0,2039
18
18
  elody/policies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- elody/policies/helpers.py,sha256=I0ctnQ0ilcbzlIfDTcgzGzAWVrrH0GoLZsB1d6sAf6I,1766
20
- elody/policies/permission_handler.py,sha256=a9kiHRINdQpkmDgrcLYZl4FplkpsURO42FMZ3Vzmdv4,10843
19
+ elody/policies/helpers.py,sha256=LTV_Hmg8AN64e6t4glpKhZMsRNYCLN8FC-KQ0-7EmR8,2035
20
+ elody/policies/permission_handler.py,sha256=dWNGzcfGoJrJjMS80-7egXzHFNaLr0UBrzXB6jwyktg,10559
21
21
  elody/policies/authentication/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  elody/policies/authentication/base_user_tenant_validation_policy.py,sha256=yyGiYy-MM63itQYwUc99FPeXt6TBW5B95FeLMfjMEok,5368
23
23
  elody/policies/authentication/multi_tenant_policy.py,sha256=g4ZYUQMmCjgLg09wj0-0lGKsJsRt7h4ppI25o1VdZHw,4039
@@ -34,13 +34,13 @@ elody/policies/authorization/mediafile_derivatives_policy.py,sha256=OwNpbS8i7-Lz
34
34
  elody/policies/authorization/mediafile_download_policy.py,sha256=XMsKavBucmTh4W1kWOzpFWxJ_ZXgHVK1RS7JB4HjtQo,1979
35
35
  elody/policies/authorization/multi_tenant_policy.py,sha256=SA9H7SBjzuh8mY3gYN7pDG8TV7hdI3GEUtNeiZeNL3M,3164
36
36
  elody/policies/authorization/tenant_request_policy.py,sha256=dEgblwRAqwWVcE-O7Jn8hVL3OnwDlQhDEOcPlcElBrk,1185
37
- elody-0.0.196.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
37
+ elody-0.0.197.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
38
38
  tests/__init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  tests/data.py,sha256=Q3oxduf-E3m-Z5G_p3fcs8jVy6g10I7zXKL1m94UVMI,2906
40
40
  tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  tests/unit/test_csv.py,sha256=NQaOhehfQ4GuXku0Y1SA8DYjJeqqidbF50zEHAi8RZA,15923
42
42
  tests/unit/test_utils.py,sha256=g63szcEZyHhCOtrW4BnNbcgVca3oYPIOLjBdIzNwwN0,8784
43
- elody-0.0.196.dist-info/METADATA,sha256=1m1zQRz7y_tJ05tOOMfPCD69nzUNSFdW6ADucbpHITs,23358
44
- elody-0.0.196.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
45
- elody-0.0.196.dist-info/top_level.txt,sha256=E0mImupLj0KmtUUCXRYEoLDRaSkuiGaOIIseAa0oQ-M,21
46
- elody-0.0.196.dist-info/RECORD,,
43
+ elody-0.0.197.dist-info/METADATA,sha256=L8aD51TwE-M6C-b8YfpJVljODpuCw5rN0HIsQKEnjVA,23358
44
+ elody-0.0.197.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
45
+ elody-0.0.197.dist-info/top_level.txt,sha256=E0mImupLj0KmtUUCXRYEoLDRaSkuiGaOIIseAa0oQ-M,21
46
+ elody-0.0.197.dist-info/RECORD,,