From b24785eda03f6278042d4c8c7d0b76da5c4c8897 Mon Sep 17 00:00:00 2001 From: Austin Raney Date: Wed, 25 Aug 2021 12:44:44 -0400 Subject: [PATCH] use user can edit criteria instead of user is owner critera. See https://github.com/hydroshare/hydroshare_jupyter_sync/pull/80\#discussion_r693181252 --- hydroshare_jupyter_sync/lib/filesystem/fs_map.py | 4 ++-- hydroshare_jupyter_sync/server.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hydroshare_jupyter_sync/lib/filesystem/fs_map.py b/hydroshare_jupyter_sync/lib/filesystem/fs_map.py index c2f590bb..d437f433 100644 --- a/hydroshare_jupyter_sync/lib/filesystem/fs_map.py +++ b/hydroshare_jupyter_sync/lib/filesystem/fs_map.py @@ -175,9 +175,9 @@ def create_map( username = hydroshare._hs_session._session.auth[0] # NOTE: assumes only resources desired for tracking are owned. may not be desirable. - # get user owned resources + # get resources the user can edit remote_resources = { - res.resource_id for res in hydroshare.search(owner=username) + res.resource_id for res in hydroshare.search(edit_permission=True) } # naively get local resources based on fs_root location and directory name length naive_local_resources = set(fs_map._get_resource_ids()) diff --git a/hydroshare_jupyter_sync/server.py b/hydroshare_jupyter_sync/server.py index 70160cac..bff3cfbc 100644 --- a/hydroshare_jupyter_sync/server.py +++ b/hydroshare_jupyter_sync/server.py @@ -370,7 +370,7 @@ def get(self, res_id): class ListUserHydroShareResources(HeadersMixIn, BaseRequestHandler): - """List the HydroShare resources a user is an owner of.""" + """List the HydroShare resources a user has edit permission of.""" _custom_headers = [("Access-Control-Allow-Methods", "GET")] @@ -378,7 +378,7 @@ def get(self): session = self.get_session() username = session.username - resources = list(session.session.search(owner=username)) + resources = list(session.session.search(edit_permission=True)) # Marshall hsclient representation into CollectionOfResourceMetadata self.write(CollectionOfResourceMetadata.parse_obj(resources).json())