earthpulse / eotdl

Earth Observation Training Datasets
https://eotdl.com
MIT License
17 stars 6 forks source link

Q1+ datasets access #172

Closed juansensio closed 2 months ago

juansensio commented 2 months ago

Only the user that ingests the dataset can download it, other users get a "You are not authorized to perform this action".

This is due to how the metadata is stored in geodb, only the user that stores it can retrieve it. Can we store metadata in geodb that is public, so any user can retrieve it?

thomasstorm commented 2 months ago

Hi Juan,

can you point me to the code eotdl is using to store the metadata in the geoDB?

earthpulse commented 2 months ago

Here we store metadata in geodb (see ingest_stac function)

https://github.com/earthpulse/eotdl/blob/main/api/api/src/usecases/datasets/ingest_file.py

The code used

# ingest to geodb
credentials = retrieve_user_credentials(user)
geodb_repo = GeoDBRepo(credentials)
geodb_repo.insert(dataset.id, values)

Here is the GeoDB repository:

https://github.com/earthpulse/eotdl/blob/main/api/api/src/repos/geodb/GeoDBRepo.py

Is used to create the client given the credentials of the user and then interact with geodb. We need to know which user inserts data but then enable any user (even without geodb credentials) to retrieve it.

thomasstorm commented 2 months ago

Thanks! All you have to do is add the line self.client.publish_collection(collection, self.database) to GeoDBRepo.py after line 29.

earthpulse commented 2 months ago

Hi, I added the line, however when I try to retrieve a datasets with a different user I still get the smae error

xcube_geodb.core.geodb.GeoDBError: b'{"code":"42P01","details":null,"hint":null,"message":"relation \"public.geodb_616b019942cfbe00690b958a_6633483d3d962cb56ebf92c6\" does not exist"}'

earthpulse commented 2 months ago

Solved issue !

We need to set a common name for self.database to allow for public collections.