elody 0.0.184__py3-none-any.whl → 0.0.187__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/job.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from elody.object_configurations.job_configuration import JobConfiguration
2
-
2
+ from datetime import datetime, timezone
3
3
 
4
4
  _config = JobConfiguration()
5
5
  _create = _config.crud()["creator"]
@@ -88,6 +88,7 @@ def start_job(
88
88
  document = {
89
89
  "id": id,
90
90
  "patch": {
91
+ "started_at": datetime.now(timezone.utc),
91
92
  "metadata": [{"key": "status", "value": "running"}],
92
93
  "relations": ([] if id_of_document_job_was_initiated_for else []),
93
94
  },
@@ -160,8 +160,8 @@ class ElodyConfiguration(BaseObjectConfiguration):
160
160
  }
161
161
  )
162
162
  sort.update({key: order})
163
-
164
- pipeline = [{"$sort": sort}]
163
+ pipeline = []
165
164
  if addFields:
166
165
  pipeline.append({"$addFields": addFields})
166
+ pipeline.append({"$sort": sort})
167
167
  return pipeline
@@ -68,7 +68,13 @@ class GetRequestRules:
68
68
  if request.method != "GET":
69
69
  return None
70
70
 
71
- return handle_single_item_request(user_context, item, permissions, "read")
71
+ return handle_single_item_request(
72
+ user_context,
73
+ item,
74
+ permissions,
75
+ "read",
76
+ key_to_check=request.args.get("key_to_check"),
77
+ )
72
78
 
73
79
 
74
80
  class PutRequestRules:
@@ -49,7 +49,13 @@ def __replace_permission_placeholders(data, placeholder_key, placeholder_value):
49
49
 
50
50
 
51
51
  def handle_single_item_request(
52
- user_context: UserContext, item, permissions, crud, request_body: dict = {}
52
+ user_context: UserContext,
53
+ item,
54
+ permissions,
55
+ crud,
56
+ request_body: dict = {},
57
+ *,
58
+ key_to_check=None,
53
59
  ):
54
60
  try:
55
61
  item_in_storage_format, flat_item, object_lists, restrictions_schema = (
@@ -72,6 +78,7 @@ def handle_single_item_request(
72
78
  crud,
73
79
  object_lists,
74
80
  flatten_dict(object_lists, request_body),
81
+ key_to_check=key_to_check,
75
82
  )
76
83
  except Exception as exception:
77
84
  log.debug(
@@ -174,6 +181,8 @@ def __is_allowed_to_crud_item_keys(
174
181
  crud,
175
182
  object_lists,
176
183
  flat_request_body: dict = {},
184
+ *,
185
+ key_to_check=None,
177
186
  ):
178
187
  user_context.bag["restricted_keys"] = []
179
188
  restrictions = restrictions_schema.get("key_restrictions", {})
@@ -201,12 +210,18 @@ def __is_allowed_to_crud_item_keys(
201
210
  )
202
211
  if element:
203
212
  item_in_storage_format[info["key"]].remove(element)
213
+ if key_to_check and key_to_check == restricted_key:
214
+ user_context.bag["restricted_keys"].append(
215
+ restricted_key
216
+ )
204
217
  break
205
218
  else:
206
219
  try:
207
220
  del item_in_storage_format[keys_info[0]["key"]][
208
221
  keys_info[1]["key"]
209
222
  ]
223
+ if key_to_check and key_to_check == restricted_key:
224
+ user_context.bag["restricted_keys"].append(restricted_key)
210
225
  except KeyError:
211
226
  pass
212
227
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: elody
3
- Version: 0.0.184
3
+ Version: 0.0.187
4
4
  Summary: elody SDK for Python
5
5
  Author-email: Inuits <developers@inuits.eu>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -4,7 +4,7 @@ elody/client.py,sha256=VFjUUaE9edtK1XuAF5T3ayem2UEBr-Anww8AhITYLdI,8575
4
4
  elody/csv.py,sha256=7ZTqwmB4CQzqN3ddoaTOKPgFHpk2UyJte-oN2994dIg,15911
5
5
  elody/error_codes.py,sha256=Derbr10Lb3HZcePjargz_XsYnw2SC0edD5KHZeKlp1s,4227
6
6
  elody/exceptions.py,sha256=5KSw2sPCZz3lDIJX4LiR2iL9n4m4KIil04D1d3X5rd0,968
7
- elody/job.py,sha256=44PeBTJucHeeEQeYiA-iTv9fxTUhbAoctIAiMzGPmAA,4171
7
+ elody/job.py,sha256=3_heLwfNrWYcjIMKPG-vWsQayAAI7tyLFUUC_b1rT7w,4264
8
8
  elody/loader.py,sha256=Mr7zyP5DP5psYerf2-DnP90GiqtFlKZpcLIPD7P4pSU,5242
9
9
  elody/schemas.py,sha256=WtKdZEAX-PtEuAaRohyS3Md8H4-8yKVXMkHfCQ2SDR4,4676
10
10
  elody/util.py,sha256=QqcqkV7GZ_1p4Uf_GJnc_nfAJt0mkBGzQ7-wCxMJ1ZM,9080
@@ -13,11 +13,11 @@ elody/migration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  elody/migration/base_object_migrator.py,sha256=n8uvgGfjEUy60G47RD7Y-oxp1vHLOauwPMDl87LcxtU,436
14
14
  elody/object_configurations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  elody/object_configurations/base_object_configuration.py,sha256=dXhzQLWtIEQHx3WSPs2R-dvN3ulcPA27G3oNGAsImBQ,6756
16
- elody/object_configurations/elody_configuration.py,sha256=Fzd9If44UNEI65i3iB5w42O4vkIgVOra8BVmwmTYpPo,6328
16
+ elody/object_configurations/elody_configuration.py,sha256=8r2mlGBiaNF3tUET86faAaZVXNBW422vPPF2cgDIn_Y,6353
17
17
  elody/object_configurations/job_configuration.py,sha256=HMDxaRUyfqhIy0q3yQDDMH9uW5iCd7VCmqknQofXNt0,2039
18
18
  elody/policies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  elody/policies/helpers.py,sha256=AV3wtvthJafW6ueEYGxggB5kk5knWTWzh3zq29Y1-ws,1434
20
- elody/policies/permission_handler.py,sha256=HIKWzl736qaeATJOhXSR_4f7taTEjYCR1t__9F6u39U,9606
20
+ elody/policies/permission_handler.py,sha256=8XfhyRVsLjcb3JaBiDtFO1w4XDDTEZUHsLN-8VDvk8I,10126
21
21
  elody/policies/tenant_id_resolver.py,sha256=BIl6lr9AH6Q_aZSsxF24B7ramkIZH-R-8bpLrTvYLtM,13796
22
22
  elody/policies/authentication/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  elody/policies/authentication/base_user_tenant_validation_policy.py,sha256=fxvrB4iG6fehBh6b4XS8AWewtNsCABgSooma5ljjZk4,5144
@@ -25,7 +25,7 @@ elody/policies/authentication/multi_tenant_policy.py,sha256=jmV1RTsApt2IV8BgSRcf
25
25
  elody/policies/authorization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  elody/policies/authorization/filter_generic_objects_policy.py,sha256=mF32moh8hRetBgG8vQW-rz4xjoRQD2yOxdI740SFSUo,6522
27
27
  elody/policies/authorization/filter_generic_objects_policy_v2.py,sha256=AUnnJpevVP7_XT7jbpt0KDJx5X96H12JKrWOkG3C-uE,6451
28
- elody/policies/authorization/generic_object_detail_policy.py,sha256=DjF_cByl6oyyEncocczx5DJUjSkSwsWjQ45-2JtKobk,3554
28
+ elody/policies/authorization/generic_object_detail_policy.py,sha256=y6g1i3vdKMKY4xS4H2m0e1DRztrivMEomx6NkDqA0Pk,3672
29
29
  elody/policies/authorization/generic_object_mediafiles_policy.py,sha256=1-DMsV-FDkcrQCE4KL-SGlVHjTZSMPwYq1bWln2nXE4,2887
30
30
  elody/policies/authorization/generic_object_metadata_policy.py,sha256=xwtOVYmiCKgf75CydfWnV7DLI9X1yVfXPQ4-Ux0Htqk,2787
31
31
  elody/policies/authorization/generic_object_relations_policy.py,sha256=hRLeA5gXB44ufiVVaxWtAuwnXBRY1U4bLWgIadzKtmw,3712
@@ -40,8 +40,8 @@ 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.184.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
44
- elody-0.0.184.dist-info/METADATA,sha256=zFLbm3NXLS9k_aJC8NgVBDM2z2blcrPlTwBHE2xHCDo,23336
45
- elody-0.0.184.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
46
- elody-0.0.184.dist-info/top_level.txt,sha256=E0mImupLj0KmtUUCXRYEoLDRaSkuiGaOIIseAa0oQ-M,21
47
- elody-0.0.184.dist-info/RECORD,,
43
+ elody-0.0.187.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
44
+ elody-0.0.187.dist-info/METADATA,sha256=4qxxxYnRYpABiRcAy3TGt1_joFzBVjk9IMi9zYltCKo,23336
45
+ elody-0.0.187.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
46
+ elody-0.0.187.dist-info/top_level.txt,sha256=E0mImupLj0KmtUUCXRYEoLDRaSkuiGaOIIseAa0oQ-M,21
47
+ elody-0.0.187.dist-info/RECORD,,