udata 9.1.0__py2.py3-none-any.whl → 9.1.1__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.
- udata/__init__.py +1 -1
- udata/core/reuse/api_fields.py +1 -1
- udata/harvest/api.py +5 -1
- udata/harvest/tests/test_api.py +33 -3
- {udata-9.1.0.dist-info → udata-9.1.1.dist-info}/METADATA +5 -1
- {udata-9.1.0.dist-info → udata-9.1.1.dist-info}/RECORD +10 -10
- {udata-9.1.0.dist-info → udata-9.1.1.dist-info}/LICENSE +0 -0
- {udata-9.1.0.dist-info → udata-9.1.1.dist-info}/WHEEL +0 -0
- {udata-9.1.0.dist-info → udata-9.1.1.dist-info}/entry_points.txt +0 -0
- {udata-9.1.0.dist-info → udata-9.1.1.dist-info}/top_level.txt +0 -0
udata/__init__.py
CHANGED
udata/core/reuse/api_fields.py
CHANGED
|
@@ -41,7 +41,7 @@ reuse_fields = api.model('Reuse', {
|
|
|
41
41
|
'last_modified': fields.ISODateTime(
|
|
42
42
|
description='The reuse last modification date', readonly=True),
|
|
43
43
|
'deleted': fields.ISODateTime(
|
|
44
|
-
description='The
|
|
44
|
+
description='The deletion date if deleted', readonly=True),
|
|
45
45
|
'datasets': fields.List(
|
|
46
46
|
fields.Nested(dataset_fields), description='The reused datasets'),
|
|
47
47
|
'organization': fields.Nested(
|
udata/harvest/api.py
CHANGED
|
@@ -8,13 +8,14 @@ from udata.auth import admin_permission
|
|
|
8
8
|
from udata.core.dataservices.models import Dataservice
|
|
9
9
|
from udata.core.dataset.api_fields import dataset_ref_fields, dataset_fields
|
|
10
10
|
from udata.core.organization.api_fields import org_ref_fields
|
|
11
|
+
from udata.core.dataset.permissions import OwnablePermission
|
|
11
12
|
from udata.core.organization.permissions import EditOrganizationPermission
|
|
12
13
|
from udata.core.user.api_fields import user_ref_fields
|
|
13
14
|
|
|
14
15
|
from . import actions
|
|
15
16
|
from .forms import HarvestSourceForm, HarvestSourceValidationForm
|
|
16
17
|
from .models import (
|
|
17
|
-
HARVEST_JOB_STATUS, HARVEST_ITEM_STATUS, HarvestJob,
|
|
18
|
+
HARVEST_JOB_STATUS, HARVEST_ITEM_STATUS, HarvestJob, HarvestSource,
|
|
18
19
|
VALIDATION_STATES, VALIDATION_ACCEPTED
|
|
19
20
|
)
|
|
20
21
|
|
|
@@ -233,6 +234,7 @@ class SourceAPI(API):
|
|
|
233
234
|
def put(self, ident):
|
|
234
235
|
'''Update a harvest source'''
|
|
235
236
|
source = actions.get_source(ident)
|
|
237
|
+
OwnablePermission(source).test()
|
|
236
238
|
form = api.validate(HarvestSourceForm, source)
|
|
237
239
|
source = actions.update_source(ident, form.data)
|
|
238
240
|
return source
|
|
@@ -241,6 +243,8 @@ class SourceAPI(API):
|
|
|
241
243
|
@api.doc('delete_harvest_source')
|
|
242
244
|
@api.marshal_with(source_fields)
|
|
243
245
|
def delete(self, ident):
|
|
246
|
+
source: HarvestSource = actions.get_source(ident)
|
|
247
|
+
OwnablePermission(source).test()
|
|
244
248
|
return actions.delete_source(ident), 204
|
|
245
249
|
|
|
246
250
|
|
udata/harvest/tests/test_api.py
CHANGED
|
@@ -295,7 +295,7 @@ class HarvestAPITest(MockBackendsMixin):
|
|
|
295
295
|
assert source['config'] == {'custom': 'value'}
|
|
296
296
|
|
|
297
297
|
def test_update_source(self, api):
|
|
298
|
-
'''It should update a source'''
|
|
298
|
+
'''It should update a source if owner or orga member'''
|
|
299
299
|
user = api.login()
|
|
300
300
|
source = HarvestSourceFactory(owner=user)
|
|
301
301
|
new_url = faker.url()
|
|
@@ -307,11 +307,31 @@ class HarvestAPITest(MockBackendsMixin):
|
|
|
307
307
|
}
|
|
308
308
|
api_url = url_for('api.harvest_source', ident=str(source.id))
|
|
309
309
|
response = api.put(api_url, data)
|
|
310
|
+
assert200(response)
|
|
311
|
+
assert response.json['url'] == new_url
|
|
310
312
|
|
|
313
|
+
# Source is now owned by orga, with user as member
|
|
314
|
+
source.organization = OrganizationFactory(members=[Member(user=user)])
|
|
315
|
+
source.save()
|
|
316
|
+
api_url = url_for('api.harvest_source', ident=str(source.id))
|
|
317
|
+
response = api.put(api_url, data)
|
|
311
318
|
assert200(response)
|
|
312
319
|
|
|
313
|
-
|
|
314
|
-
|
|
320
|
+
def test_update_source_require_permission(self, api):
|
|
321
|
+
'''It should not update a source if not the owner'''
|
|
322
|
+
api.login()
|
|
323
|
+
source = HarvestSourceFactory()
|
|
324
|
+
new_url: str = faker.url()
|
|
325
|
+
data = {
|
|
326
|
+
'name': source.name,
|
|
327
|
+
'description': source.description,
|
|
328
|
+
'url': new_url,
|
|
329
|
+
'backend': 'factory',
|
|
330
|
+
}
|
|
331
|
+
api_url: str = url_for('api.harvest_source', ident=str(source.id))
|
|
332
|
+
response = api.put(api_url, data)
|
|
333
|
+
|
|
334
|
+
assert403(response)
|
|
315
335
|
|
|
316
336
|
def test_validate_source(self, api):
|
|
317
337
|
'''It should allow to validate a source if admin'''
|
|
@@ -388,6 +408,16 @@ class HarvestAPITest(MockBackendsMixin):
|
|
|
388
408
|
deleted_sources = HarvestSource.objects(deleted__exists=True)
|
|
389
409
|
assert len(deleted_sources) == 1
|
|
390
410
|
|
|
411
|
+
def test_delete_source_require_permission(self, api):
|
|
412
|
+
'''It should not delete a source if not the owner'''
|
|
413
|
+
api.login()
|
|
414
|
+
source = HarvestSourceFactory()
|
|
415
|
+
|
|
416
|
+
url = url_for('api.harvest_source', ident=str(source.id))
|
|
417
|
+
response = api.delete(url)
|
|
418
|
+
|
|
419
|
+
assert403(response)
|
|
420
|
+
|
|
391
421
|
def test_schedule_source(self, api):
|
|
392
422
|
'''It should allow to schedule a source if admin'''
|
|
393
423
|
api.login(AdminFactory())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: udata
|
|
3
|
-
Version: 9.1.
|
|
3
|
+
Version: 9.1.1
|
|
4
4
|
Summary: Open data portal
|
|
5
5
|
Home-page: https://github.com/opendatateam/udata
|
|
6
6
|
Author: Opendata Team
|
|
@@ -135,6 +135,10 @@ It is collectively taken care of by members of the
|
|
|
135
135
|
|
|
136
136
|
# Changelog
|
|
137
137
|
|
|
138
|
+
## 9.1.1 (2024-07-16)
|
|
139
|
+
|
|
140
|
+
- Add correct owner permissions on harvest sources [#3091](https://github.com/opendatateam/udata/pull/3091)
|
|
141
|
+
|
|
138
142
|
## 9.1.0 (2024-07-11)
|
|
139
143
|
|
|
140
144
|
- Add reports backend [#3069](https://github.com/opendatateam/udata/pull/3069) and [#3078](https://github.com/opendatateam/udata/pull/3078)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
tasks/__init__.py,sha256=CnVhb_TV-6nMhxVR6itnBmvuU2OSCs02AfNB4irVBTE,8132
|
|
2
2
|
tasks/helpers.py,sha256=k_HiuiEJNgQLvWdeHqczPOAcrYpFjEepBeKo7EQzY8M,994
|
|
3
|
-
udata/__init__.py,sha256=
|
|
3
|
+
udata/__init__.py,sha256=00Am56rwXmIVejvRPsNTl7Hn1mnVFxT1iYo6ZAt75XM,97
|
|
4
4
|
udata/api_fields.py,sha256=zx-BPYajUyRKOOIFIebn-MFSrRIyi4O-sf97V7KjoOI,13461
|
|
5
5
|
udata/app.py,sha256=6upwrImLaWrSYtsXPW1zH84_oRxp3B6XFuocMe2D6NU,7329
|
|
6
6
|
udata/assets.py,sha256=aMa-MnAEXVSTavptSn2V8sUE6jL_N0MrYCQ6_QpsuHs,645
|
|
@@ -168,7 +168,7 @@ udata/core/reports/models.py,sha256=eIQOKHJHaE5GeFguLsRJMUbHzdK77FXPpcsEBFcBYNg,
|
|
|
168
168
|
udata/core/reuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
169
169
|
udata/core/reuse/activities.py,sha256=rdl_CR3RJPBMonsHYmPnPVDvCYozNdXN2H1ILrTItNQ,1417
|
|
170
170
|
udata/core/reuse/api.py,sha256=72oJxmwziqvuFhxcuXy-5ckhQo39t65hp4eqvSqbQ6o,10237
|
|
171
|
-
udata/core/reuse/api_fields.py,sha256=
|
|
171
|
+
udata/core/reuse/api_fields.py,sha256=WXzhHBQnGLI1AMWGKKkFkCscJZNDyc99vXbW63EYJFo,4872
|
|
172
172
|
udata/core/reuse/apiv2.py,sha256=Op4f6pSMdUuLcCwNadojJfHfU6UYohrzSxlJbRn3wHc,824
|
|
173
173
|
udata/core/reuse/constants.py,sha256=pbCR1xX9v4tdewlOx8bgNmy1-5V9OXIbpNjJivnQ--A,1215
|
|
174
174
|
udata/core/reuse/csv.py,sha256=bOKS3LYGmQHj-qPkvxZVnbIju_sYDYjehGCM3Bj75lM,843
|
|
@@ -276,7 +276,7 @@ udata/frontend/csv.py,sha256=SDV8GMhNpHyE9NYy9cfHulsFUzwclfc7roWAAm-PZ9M,8257
|
|
|
276
276
|
udata/frontend/markdown.py,sha256=41bOiU6AKng4U-5v3otBed3dyCu63NI9fnznUQThbIk,4377
|
|
277
277
|
udata/harvest/__init__.py,sha256=C4y5w4vGb_F9Opy62lzV3eHo4DkNyRgPCq-wsarPXiQ,28
|
|
278
278
|
udata/harvest/actions.py,sha256=6f9bkIITLHes0vGU-yioRGfFOghAS3nXThXEVKaHFpA,10082
|
|
279
|
-
udata/harvest/api.py,sha256=
|
|
279
|
+
udata/harvest/api.py,sha256=xAUzJL6fbj_XZnjo-9MPxlaiQ39AuDkGKIggbkF731c,14990
|
|
280
280
|
udata/harvest/commands.py,sha256=Vo1KxO7GAOgQ87khqlGIyjZIlwAOlQ8ztadqmWdMvwk,4922
|
|
281
281
|
udata/harvest/csv.py,sha256=c2fPnMB6q99wRxLncl8L0ILcdF4SI8Lsl8tViNrcW6A,396
|
|
282
282
|
udata/harvest/exceptions.py,sha256=YaXw0ESmSCcibfUmP5uc1uRedKD2mvUBXUOnbaSXtNw,299
|
|
@@ -292,7 +292,7 @@ udata/harvest/backends/dcat.py,sha256=-VvV3eHuiEMUbms15VdKO4ONQiqtoLLFR0425km9C_
|
|
|
292
292
|
udata/harvest/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
293
293
|
udata/harvest/tests/factories.py,sha256=vUFON9GzI5CbD3bP8_ayOs3S9pHbhhHiI7B4GhoQtVE,2218
|
|
294
294
|
udata/harvest/tests/test_actions.py,sha256=TPHb8n8tlQ0l2lu8GzbymKPOpzTeN_VCtFmszZoCAQI,27583
|
|
295
|
-
udata/harvest/tests/test_api.py,sha256=
|
|
295
|
+
udata/harvest/tests/test_api.py,sha256=JmtgsTD4GeDmwLfXNy2oYn-4_JzG-v6yMXcBDZ6iKXQ,16028
|
|
296
296
|
udata/harvest/tests/test_base_backend.py,sha256=idFssHnN1iv2ktP1b1IlDpGglVR4Rzza-XuJr68KIlA,12240
|
|
297
297
|
udata/harvest/tests/test_dcat_backend.py,sha256=bOb6hmgoGB4usjFA6s9fzLKAMGOKmWXFpF0DEPeJBVQ,34118
|
|
298
298
|
udata/harvest/tests/test_filters.py,sha256=V2HFZlexIJa6r1DX6g2ktvIgjg4gSY11QPfPOd3_Oug,2370
|
|
@@ -696,9 +696,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=yfwqLHV-_mGNaDklP7T0pQP4i1y__s
|
|
|
696
696
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=E45ZRCW2bpedoWOztkgJ9gwBlg2L1pTcHmCXgqSdhT0,44979
|
|
697
697
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=w_x0mh_WagUuQ5QFweqHg5-HtDrsoyL66HVmUxrdR0U,28500
|
|
698
698
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=LfaUQzhrfDClLdBo_U2erasp2XR1z1_V132cewvZ9C8,51548
|
|
699
|
-
udata-9.1.
|
|
700
|
-
udata-9.1.
|
|
701
|
-
udata-9.1.
|
|
702
|
-
udata-9.1.
|
|
703
|
-
udata-9.1.
|
|
704
|
-
udata-9.1.
|
|
699
|
+
udata-9.1.1.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
700
|
+
udata-9.1.1.dist-info/METADATA,sha256=Va5grYrIVFZYj_XL7isxDfq-Tw_MxT6GX-mzxclR9P4,125826
|
|
701
|
+
udata-9.1.1.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
|
702
|
+
udata-9.1.1.dist-info/entry_points.txt,sha256=3SKiqVy4HUqxf6iWspgMqH8d88Htk6KoLbG1BU-UddQ,451
|
|
703
|
+
udata-9.1.1.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
|
|
704
|
+
udata-9.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|