magda-io / magda

A federated, open-source data catalog for all your big data and small data
https://magda.io
Apache License 2.0
515 stars 93 forks source link

CKAN Redirection doesn't work with multi-tenant #2343

Open AlexGilleran opened 5 years ago

AlexGilleran commented 5 years ago

Problem description

The CKAN redirection module in the gateway doesn't know how to figure out who the client is to put in a X-Magda-Tenant-Id header in its req to the gateway to look up matching datasets.

Currently it works for single tenant because it's hard-coded to id 0, but this means in multi tenant it will look up the wrong CKAN datasets.

mwu2018 commented 5 years ago

How do you re-produce this bug? In multi-tenant mode, I enabled Ckan redirection:

gateway:
  ckanRedirectionDomain: "ckan.data.gov.au"
  ckanRedirectionPath: ""
  enableCkanRedirection: true

and create a ckan connector job for tenant 2:

connectors:
  config:
    - image:
        name: magda-ckan-connector
      id: brisbane
      name: Brisbane City Council
      sourceUrl: https://www.data.brisbane.qld.gov.au/data/
      pageSize: 100
      tenantId: 2

After deployment, I can search and navigate without problem. What did I miss out?

t83714 commented 5 years ago

~@mwu2018 It seems @AlexGilleran already includes fixes for this ticket in his PR here: https://github.com/magda-io/magda/pull/2342 You probably want to review that PR instead~

I was wrong. Only ticket created