Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion geonode/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def test_dataset_get_detail_unauth_dataset_not_public(self):

self.client.login(username=self.user, password=self.passwd)
resp = self.client.get(list_url)
self.assertEqual(len(self.deserialize(resp)["objects"]), 7) # admin can't see resources in dirty_state
self.assertEqual(len(self.deserialize(resp)["objects"]), 8) # admin can see resources in dirty_state

self.client.logout()
resp = self.client.get(list_url)
Expand Down
4 changes: 2 additions & 2 deletions geonode/layers/api/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def filter_queryset(self, request, queryset, view):
polymorphic_ctype__model="dataset"
)
try:
include_dirty = strtobool(request.query_params.get("include_dirty", "False"))
include_dirty = strtobool(request.query_params.get("include_dirty", "True"))
except Exception:
include_dirty = False
include_dirty = True

obj_with_perms = get_visible_resources(
resources,
Expand Down
11 changes: 5 additions & 6 deletions geonode/layers/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_datasets(self):
@override_settings(REST_API_DEFAULT_PAGE_SIZE=100)
def test_filter_dirty_state(self):
"""
ensure that a dirty_state dataset wont be returned
ensure that a dirty_state dataset will be returned
"""

# ensure that there is atleast one resource with dirty_state
Expand All @@ -140,12 +140,11 @@ def test_filter_dirty_state(self):
self.assertEqual(response.status_code, 200)
dataset_list = response.data["datasets"]

# ensure that list count is equal to that of clean data
# clean resources
resource_count_clean = Dataset.objects.filter(dirty_state=False).count()
# dirty resource is now included in count
resource_count_clean = Dataset.objects.count()
self.assertEqual(len(dataset_list), resource_count_clean)
# ensure that the updated dirty dataset is not in the response
self.assertFalse(dirty_dataset.pk in [int(dataset["pk"]) for dataset in dataset_list])
# ensure that the updated dirty dataset is included in the response
self.assertTrue(dirty_dataset.pk in [int(dataset["pk"]) for dataset in dataset_list])

@override_settings(REST_API_DEFAULT_PAGE_SIZE=100)
def test_filter_dirty_state_include_dirty(self):
Expand Down
2 changes: 1 addition & 1 deletion geonode/security/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def get_visible_resources(
admin_approval_required=False,
unpublished_not_visible=False,
private_groups_not_visibile=False,
include_dirty=False,
include_dirty=True,
):
# Get the list of objects the user has access to
from geonode.groups.models import GroupProfile
Expand Down
2 changes: 1 addition & 1 deletion geonode/security/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_visible_resources(
admin_approval_required=False,
unpublished_not_visible=False,
private_groups_not_visibile=False,
include_dirty=False,
include_dirty=True,
):
"""
We should use the registry to get the visible resources.
Expand Down
7 changes: 7 additions & 0 deletions geonode/upload/celery_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,13 @@ def copy_geonode_resource(self, exec_id, actual_step, layer_name, alternate, han

_exec = orchestrator.get_execution_object(exec_id)

# Update input_params with original resource's uuid immediately so the API
# can find this execution request for original the dirty resource
orchestrator.update_execution_request_status(
execution_id=str(_exec.exec_id),
input_params={**_exec.input_params, **{"uuid": resource.uuid}},
)

workspace = resource.alternate.split(":")[0]

data_to_update = {
Expand Down
Loading