udata 10.3.3.dev35068__py2.py3-none-any.whl → 10.3.3.dev35091__py2.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 udata might be problematic. Click here for more details.

@@ -54,8 +54,11 @@ class DataserviceAPI(API):
54
54
  @api.doc("get_dataservice")
55
55
  @api.marshal_with(Dataservice.__read_fields__)
56
56
  def get(self, dataservice):
57
- if dataservice.deleted_at and not OwnablePermission(dataservice).can():
58
- api.abort(410, "Dataservice has been deleted")
57
+ if not OwnablePermission(dataservice).can():
58
+ if dataservice.private:
59
+ api.abort(404)
60
+ elif dataservice.deleted_at:
61
+ api.abort(410, "Dataservice has been deleted")
59
62
  return dataservice
60
63
 
61
64
  @api.secure
udata/core/dataset/api.py CHANGED
@@ -300,8 +300,11 @@ class DatasetAPI(API):
300
300
  @api.marshal_with(dataset_fields)
301
301
  def get(self, dataset):
302
302
  """Get a dataset given its identifier"""
303
- if dataset.deleted and not DatasetEditPermission(dataset).can():
304
- api.abort(410, "Dataset has been deleted")
303
+ if not DatasetEditPermission(dataset).can():
304
+ if dataset.private:
305
+ api.abort(404)
306
+ elif dataset.deleted:
307
+ api.abort(410, "Dataset has been deleted")
305
308
  return dataset
306
309
 
307
310
  @api.secure
udata/core/reuse/api.py CHANGED
@@ -138,8 +138,11 @@ class ReuseAPI(API):
138
138
  @api.marshal_with(Reuse.__read_fields__)
139
139
  def get(self, reuse):
140
140
  """Fetch a given reuse"""
141
- if reuse.deleted and not ReuseEditPermission(reuse).can():
142
- api.abort(410, "This reuse has been deleted")
141
+ if not ReuseEditPermission(reuse).can():
142
+ if reuse.private:
143
+ api.abort(404)
144
+ elif reuse.deleted:
145
+ api.abort(410, "This reuse has been deleted")
143
146
  return reuse
144
147
 
145
148
  @api.secure
@@ -1,3 +1,4 @@
1
+ from datetime import datetime
1
2
  from xml.etree.ElementTree import XML
2
3
 
3
4
  import pytest
@@ -17,7 +18,7 @@ from udata.core.organization.factories import OrganizationFactory
17
18
  from udata.core.organization.models import Member
18
19
  from udata.core.user.factories import AdminFactory, UserFactory
19
20
  from udata.i18n import gettext as _
20
- from udata.tests.helpers import assert200, assert400, assert_redirects
21
+ from udata.tests.helpers import assert200, assert400, assert410, assert_redirects
21
22
 
22
23
  from . import APITestCase
23
24
 
@@ -30,6 +31,40 @@ def dataservice_in_response(response: TestResponse, dataservice: Dataservice) ->
30
31
  class DataserviceAPITest(APITestCase):
31
32
  modules = []
32
33
 
34
+ def test_dataservice_api_get(self):
35
+ """It should fetch a dataservice from the API"""
36
+ dataservice = DataserviceFactory()
37
+ response = self.get(url_for("api.dataservice", dataservice=dataservice))
38
+ assert200(response)
39
+
40
+ def test_dataservice_api_get_deleted(self):
41
+ """It should not fetch a deleted dataservice from the API and raise 410"""
42
+ dataservice = DataserviceFactory(deleted_at=datetime.utcnow())
43
+ response = self.get(url_for("api.dataservice", dataservice=dataservice))
44
+ assert410(response)
45
+
46
+ def test_dataservice_api_get_deleted_but_authorized(self):
47
+ """It should fetch a deleted dataservice from the API if authorized"""
48
+ user = self.login()
49
+ dataservice = DataserviceFactory(deleted_at=datetime.utcnow(), owner=user)
50
+ response = self.get(url_for("api.dataservice", dataservice=dataservice))
51
+ assert200(response)
52
+
53
+ def test_dataservice_api_get_private(self):
54
+ """It should not fetch a private dataservice from the API and raise 404"""
55
+ dataservice = DataserviceFactory(private=True)
56
+
57
+ response = self.get(url_for("api.dataservice", dataservice=dataservice))
58
+ self.assert404(response)
59
+
60
+ def test_dataservice_api_get_private_but_authorized(self):
61
+ """It should fetch a private dataservice from the API if user is authorized"""
62
+ self.login()
63
+ dataservice = DataserviceFactory(owner=self.user, private=True)
64
+
65
+ response = self.get(url_for("api.dataservice", dataservice=dataservice))
66
+ self.assert200(response)
67
+
33
68
  def test_dataservices_api_list_with_filters(self):
34
69
  """Should filters dataservices results based on query filters"""
35
70
  org = OrganizationFactory()
@@ -174,10 +209,10 @@ class DataserviceAPITest(APITestCase):
174
209
  response = self.get(url_for("api.dataservice", dataservice=dataservice))
175
210
  self.assert200(response)
176
211
 
177
- # We cannot access deleted element as random user
212
+ # We cannot access private element as random user
178
213
  self.login()
179
214
  response = self.get(url_for("api.dataservice", dataservice=dataservice))
180
- self.assert410(response)
215
+ self.assert404(response)
181
216
 
182
217
  # We can undelete with a patch
183
218
  self.login(user)
@@ -484,13 +484,28 @@ class DatasetAPITest(APITestCase):
484
484
  self.assert410(response)
485
485
 
486
486
  def test_dataset_api_get_deleted_but_authorized(self):
487
- """It should a deleted dataset from the API if user is authorized"""
487
+ """It should fetch a deleted dataset from the API if user is authorized"""
488
488
  self.login()
489
489
  dataset = DatasetFactory(owner=self.user, deleted=datetime.utcnow())
490
490
 
491
491
  response = self.get(url_for("api.dataset", dataset=dataset))
492
492
  self.assert200(response)
493
493
 
494
+ def test_dataset_api_get_private(self):
495
+ """It should not fetch a private dataset from the API and raise 404"""
496
+ dataset = DatasetFactory(private=True)
497
+
498
+ response = self.get(url_for("api.dataset", dataset=dataset))
499
+ self.assert404(response)
500
+
501
+ def test_dataset_api_get_private_but_authorized(self):
502
+ """It should fetch a private dataset from the API if user is authorized"""
503
+ self.login()
504
+ dataset = DatasetFactory(owner=self.user, private=True)
505
+
506
+ response = self.get(url_for("api.dataset", dataset=dataset))
507
+ self.assert200(response)
508
+
494
509
  def test_dataset_api_create(self):
495
510
  """It should create a dataset from the API"""
496
511
  data = DatasetFactory.as_dict()
@@ -257,6 +257,21 @@ class ReuseAPITest:
257
257
  response = api.get(url_for("api.reuse", reuse=reuse))
258
258
  assert200(response)
259
259
 
260
+ def test_reuse_api_get_private(self, api):
261
+ """It should not fetch a private reuse from the API and raise 404"""
262
+ reuse = ReuseFactory(private=True)
263
+
264
+ response = api.get(url_for("api.reuse", reuse=reuse))
265
+ assert404(response)
266
+
267
+ def test_reuse_api_get_private_but_authorized(self, api):
268
+ """It should fetch a private reuse from the API if user is authorized"""
269
+ user = api.login()
270
+ reuse = ReuseFactory(owner=user, private=True)
271
+
272
+ response = api.get(url_for("api.reuse", reuse=reuse))
273
+ assert200(response)
274
+
260
275
  def test_reuse_api_create(self, api):
261
276
  """It should create a reuse from the API"""
262
277
  data = ReuseFactory.as_dict()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: udata
3
- Version: 10.3.3.dev35068
3
+ Version: 10.3.3.dev35091
4
4
  Summary: Open data portal
5
5
  Home-page: https://github.com/opendatateam/udata
6
6
  Author: Opendata Team
@@ -142,6 +142,7 @@ It is collectively taken care of by members of the
142
142
  ## Current (in progress)
143
143
 
144
144
  - Improve reuse api perfs by adding a mask on datasets [#3309](https://github.com/opendatateam/udata/pull/3309)
145
+ - Private objects should return 404 by api [#3311](https://github.com/opendatateam/udata/pull/3311)
145
146
  - Add `featured` to dataset default mask [#3313](https://github.com/opendatateam/udata/pull/3313)
146
147
 
147
148
  ## 10.3.2 (2025-05-06)
@@ -81,7 +81,7 @@ udata/core/contact_point/factories.py,sha256=YoW2PKKaemYO4lIy5MwpH36uXM_J3rE-Ihs
81
81
  udata/core/contact_point/forms.py,sha256=oBe1agSJFyx2QRgYzPRg2A7qVscaBTaKG4V-AyIwnF8,729
82
82
  udata/core/contact_point/models.py,sha256=Xqmqg7S13gcaKxiQT52WHeQEHTaUDDGIXInXyqNh4Po,854
83
83
  udata/core/dataservices/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
84
- udata/core/dataservices/api.py,sha256=aX9f4cDT_7XYjES5lY-ar-sC1z-xopiPrL-vPuB1nkc,7303
84
+ udata/core/dataservices/api.py,sha256=7jOn3Ug63-5wjXP0d_zL0whdCQeHG_eQ1Y-wNhUuPLM,7388
85
85
  udata/core/dataservices/apiv2.py,sha256=XIqJq58uLtxtt52iKYo7Fl0ZXv9Sz72uA7JIGwP8Qos,995
86
86
  udata/core/dataservices/constants.py,sha256=LBCTQ44YvjTZfQVbxFiovPxapAknSJNOZKjMP8WeFy4,351
87
87
  udata/core/dataservices/csv.py,sha256=pcNIeGaCzBMMna3n3YqHjsoXzfLtg_ITtDmdKb9svDc,1053
@@ -94,7 +94,7 @@ udata/core/dataservices/tasks.py,sha256=d2tG1l6u8-eUKUYBOgnCsQLbLmLgJXU-DOzZWhhL
94
94
  udata/core/dataset/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
95
95
  udata/core/dataset/actions.py,sha256=mX6xox0PiMrbcAPZ3VZsI26rfM-ciYfEXxN6sqqImKA,1222
96
96
  udata/core/dataset/activities.py,sha256=v8k1jwhdx62Z2ARZq8Q-x86OWSsBK99hRloPl74OCgA,1502
97
- udata/core/dataset/api.py,sha256=Xif5NcmxXMrTnDwWi3RKfzIp_FxlYVTVcYCgPi2g0M0,33120
97
+ udata/core/dataset/api.py,sha256=gMpY3w1BhXtPPiHC7UZ0bfIFyp34Jwio0NaUmwutmVg,33201
98
98
  udata/core/dataset/api_fields.py,sha256=SLuzWoPdMLPX28WQ9DRGUPKS27vlltiFeiTo6jXa55Q,17549
99
99
  udata/core/dataset/apiv2.py,sha256=5tBsbEbF7kjUHP0X9Xd6qDSI9bqNBgYvRaWs0n3r1OM,17803
100
100
  udata/core/dataset/commands.py,sha256=__hPAk_6iHtgMnEG51ux0vbNWJHxUjXhi1ukH4hF5jY,3714
@@ -174,7 +174,7 @@ udata/core/reports/constants.py,sha256=LRZSX3unyqZeB4yQjK3ws_hGbJcXYk4bu1Rhnhi5D
174
174
  udata/core/reports/models.py,sha256=AsW5p2ZIdR4c6vNzglEN7MX03It-t9u7ktOsVZqvzSs,2702
175
175
  udata/core/reuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
176
176
  udata/core/reuse/activities.py,sha256=mAdHhqqpUF5zSh4e5AEo0J7alc3RflTbudDaKOzyTQw,1406
177
- udata/core/reuse/api.py,sha256=JIT7-kUf6l0BSW3hSdRHjS0OM5eJxdlFGdXUESzLBKY,10849
177
+ udata/core/reuse/api.py,sha256=931cn6CGVcHv0XhSAXyjHkKy-9nOGHaHdE3uMU8v9mc,10928
178
178
  udata/core/reuse/api_fields.py,sha256=c61Gl56UjiBpXS0Nbvcoi_QHdUmhnBtqWm6nNHRYKyc,1232
179
179
  udata/core/reuse/apiv2.py,sha256=nZe-v8713aXKuv2B578NdxfrIckjbxhS3zUXAKSIKTI,835
180
180
  udata/core/reuse/constants.py,sha256=JgDBrjOKSt9q0auv9rjzbGsch83H-Oi8YXAKeI5hO4o,1215
@@ -625,14 +625,14 @@ udata/tests/api/test_activities_api.py,sha256=RjDDeNle3T-ydVnh6BRypqxAE_244-DXaK
625
625
  udata/tests/api/test_auth_api.py,sha256=OMRlY0OQt60j5N4A-N3HdWTuffOjRlFHkz5a3jJFieI,25987
626
626
  udata/tests/api/test_base_api.py,sha256=2w_vz0eEuq3P3aN-ByvxGc3VZAo7XtgatFfcrzf2uEU,2244
627
627
  udata/tests/api/test_contact_points.py,sha256=X_RWD_xCfR8WchhHfKEt5mxMHY77OmTyguNKCsZftdE,5337
628
- udata/tests/api/test_dataservices_api.py,sha256=jntjiLUWfAeFj-8VW3szcHLSNKSp8qFopUDAC5bxWuY,24102
629
- udata/tests/api/test_datasets_api.py,sha256=Cp0SeDjj_Yjf3aNcSStHbFm4kaxIAn8rOCIpX60I7aM,94261
628
+ udata/tests/api/test_dataservices_api.py,sha256=fNpeHl4SMvci3QrC414X6KGorv7NS1y8LsGxcSMjjZY,25729
629
+ udata/tests/api/test_datasets_api.py,sha256=0MuIxHimP24waJPu91aXR1HOyBO_YgsPp7KOkB8hkuk,94872
630
630
  udata/tests/api/test_fields.py,sha256=OW85Z5MES5HeWOpapeem8OvR1cIcrqW-xMWpdZO4LZ8,1033
631
631
  udata/tests/api/test_follow_api.py,sha256=XP6I96JUNT6xjGcQOF7pug_T_i67HzCiOGLaPdpfpEQ,4912
632
632
  udata/tests/api/test_me_api.py,sha256=YPd8zmR3zwJKtpSqz8nY1nOOMyXs66INeBwyhg5D0Us,13846
633
633
  udata/tests/api/test_organizations_api.py,sha256=-jV2By1qkcxtrm57jVKqKa8nvvCCohGUz63QT9uZgZQ,41209
634
634
  udata/tests/api/test_reports_api.py,sha256=fCSz9NwMXBs6cxdXBVVI6y564AtovmZYw3xkgxQ9KE8,6217
635
- udata/tests/api/test_reuses_api.py,sha256=d8mtUrDURIfnUK-sLogvAP-rOID2FDJ0UVTM0ravQ-Q,24642
635
+ udata/tests/api/test_reuses_api.py,sha256=x7SG8tNmuPDAaK-t0E_Y02-_5g4o8t7dnVdfgE1Qu08,25218
636
636
  udata/tests/api/test_swagger.py,sha256=eE6La9qdTYTIUFevRVPJgtj17Jq_8uOlsDwzCNR0LL8,760
637
637
  udata/tests/api/test_tags_api.py,sha256=36zEBgthVEn6pctJ0kDgPmEaUr-iqRAHeZRcRG2LEXQ,2425
638
638
  udata/tests/api/test_topics_api.py,sha256=beIPbDA8PHo4FZogeio-j1MO6Eatt9oFSlp-aHpgEtQ,12200
@@ -726,9 +726,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=ViV14tUmjSydHS0TWG_mFikKQfyUaT
726
726
  udata/translations/pt/LC_MESSAGES/udata.po,sha256=rzAD_MVoV54TmN3w1ECz3H2Ru5pM7hWMVH03SkY28Q8,47250
727
727
  udata/translations/sr/LC_MESSAGES/udata.mo,sha256=EHX1_D-Uglj38832G7BrA0QC5IuY3p8dKqi9T0DgPmE,29169
728
728
  udata/translations/sr/LC_MESSAGES/udata.po,sha256=3PMnbVhKVJh6Q8ABi1ZTZ8Dcf-sMjngLJZqLbonJoec,54225
729
- udata-10.3.3.dev35068.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
730
- udata-10.3.3.dev35068.dist-info/METADATA,sha256=ryDQc1Wt1G4ENdYlyst4xltkRgWebQtZ9E9Pc21DC_Q,145583
731
- udata-10.3.3.dev35068.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
732
- udata-10.3.3.dev35068.dist-info/entry_points.txt,sha256=ETvkR4r6G1duBsh_V_fGWENQy17GTFuobi95MYBAl1A,498
733
- udata-10.3.3.dev35068.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
734
- udata-10.3.3.dev35068.dist-info/RECORD,,
729
+ udata-10.3.3.dev35091.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
730
+ udata-10.3.3.dev35091.dist-info/METADATA,sha256=xmwqnPVt3J6JKkTa3QniKR_hmPu9B1pxhmpMACyd6_c,145683
731
+ udata-10.3.3.dev35091.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
732
+ udata-10.3.3.dev35091.dist-info/entry_points.txt,sha256=ETvkR4r6G1duBsh_V_fGWENQy17GTFuobi95MYBAl1A,498
733
+ udata-10.3.3.dev35091.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
734
+ udata-10.3.3.dev35091.dist-info/RECORD,,