Skip to content

Commit

Permalink
[33x] Set target store during upload phase (#9266)
Browse files Browse the repository at this point in the history
* [Fixes #9210] Owner is still able to edit data and style after a resource has been approved and A/W is active

* [Fixes #9210] Fix test

* [Fixes #9210] Fix permissions list returned by the API

* [Fixes #9210] Add check to ensure that layer permissions are removed only if is the resource is a layer

* Update uploadhandler.py

By default even the layer used the document upload size milit

* Update uploadhandler.py

* Update forms.py

* Set target store at session creation

* Fix broken upload tests

* Test fix replace layer

* Test fix replace layer

* Remove duplicate call to set_target during import

* handling concurrency

* - Acquiring lock on "save_step" before computing the new "import_id"

 - Some PEP-8 love

Co-authored-by: afabiani <[email protected]>
  • Loading branch information
mattiagiupponi and afabiani authored May 6, 2022
1 parent 417a4f9 commit f4d7817
Show file tree
Hide file tree
Showing 4 changed files with 203 additions and 198 deletions.
11 changes: 8 additions & 3 deletions geonode/geoserver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1419,9 +1419,14 @@ def create_geoserver_db_featurestore(

if ds_exists:
ds.save_method = "PUT"

logger.debug('Updating target datastore % s' % dsname)
cat.save(ds)
else:
logger.debug('Updating target datastore % s' % dsname)
try:
cat.save(ds)
except FailedRequestError as e:
if 'already exists in workspace' not in e.args[0]:
raise e
logger.warning("The store was already present in the workspace selected")

logger.debug('Reloading target datastore % s' % dsname)
ds = get_store(cat, dsname, workspace=workspace)
Expand Down
4 changes: 2 additions & 2 deletions geonode/upload/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ def _update_upload_session_state(self, upload_session_id: int):
# GeoNode Layer successfully processed...
_upload.set_processing_state(Upload.STATE_PROCESSED)
elif (session.state == Upload.STATE_COMPLETE and _upload.state in (
Upload.STATE_COMPLETE, Upload.STATE_PENDING) and not _tasks_waiting) or (
session.state == Upload.STATE_PENDING and _tasks_ready):
Upload.STATE_COMPLETE, Upload.STATE_PENDING) and not _tasks_waiting) or (
session.state == Upload.STATE_PENDING and _tasks_ready):
if not _upload.layer:
_response = final_step_view(None, _upload.get_session)
if _response:
Expand Down
Loading

0 comments on commit f4d7817

Please sign in to comment.