Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting VSI credentials when loading OGR/GDAL layers #57826

Merged
merged 19 commits into from
Jun 24, 2024

Conversation

nyalldawson
Copy link
Collaborator

@nyalldawson nyalldawson commented Jun 22, 2024

This PR exposes the VSI credential options for user control when adding OGR vector/GDAL raster layers from the Data Source Manager, eg:

image

The underlying provider changes were discussed in #57801. When credential options are found in a layer's URI, we use GDAL's VSISetPathSpecificOption to set the credential option for that VSI driver and bucket.

This allows per-vsi driver & bucket credentials for layers, whereas other approaches (like environment variable setting) force a single set of credentials to be used for an entire QGIS session. (And are difficult for users to set)

I've also taken the opportunity to cleanup a bunch of code relating to how VSI protocols are exposed in GUI, and how GUIs for GDAL configuration options are dynamically created.

Requires GDAL 3.5+

Extends decode/encodeUri to handle credential options. This is
modeled off the existing support for storing open options.

When credential options are found in a layer's URI, we use
GDAL's VSISetPathSpecificOption to set the credential option
for that VSI driver and bucket. This allows per-vsi driver & bucket
credentials for GDAL/OGR layers, whereas other approaches (like environment
variable setting) force a single set of credentials to be used
for an entire QGIS session.

Requires GDAL 3.5+
- Don't rely on translated combo box strings, use item data instead
- Reduce duplicate code
- Add missing Hadoop option
- Avoid unnecessary string list creation/splitting when populating
  combos
A resuable widget for configuration GDAL credential options
for vsi file systems
Allows users to configure credentials to use when connecting to
GDAL cloud storage providers, e.g. AWS
@nyalldawson nyalldawson added Feature Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels Jun 22, 2024
@qgis-bot
Copy link
Collaborator

@nyalldawson

This pull request has been tagged for the changelog.

  • The description will be harvested so please provide a "nearly-ready" text for the final changelog
  • If possible, add a nice illustration of the feature. Only the first one in the description will be harvested (GIF accepted as well)
  • If you can, it's better to give credits to your sponsor, see below for different formats.

You can edit the description.

Format available for credits
  • Funded by NAME
  • Funded by URL
  • Funded by NAME URL
  • Sponsored by NAME
  • Sponsored by URL
  • Sponsored by NAME URL

Thank you!

@github-actions github-actions bot added this to the 3.40.0 milestone Jun 22, 2024
@nirvn
Copy link
Contributor

nirvn commented Jun 22, 2024

@nyalldawson , that's really nice. The limited one credential (via environment variables) was making it really hard to enjoy cloud hosted datasets before

Copy link

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit 2c00e70)

@agiudiceandrea agiudiceandrea added the Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo. label Jun 22, 2024
@qgis-bot
Copy link
Collaborator

@nyalldawson
This pull request has been tagged as requiring documentation.

A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged.

Please update the description (not the comments) with helpful description and screenshot to help the work from documentors.
Also, any commit having [needs-doc] or [Needs Documentation] in will see its message pushed to the issue, so please be as verbose as you can.

Thank you!

@nyalldawson nyalldawson merged commit 81c28c4 into qgis:master Jun 24, 2024
33 checks passed
@nyalldawson nyalldawson deleted the vsi_credential_options branch June 24, 2024 20:08
@qgis-bot
Copy link
Collaborator

@nyalldawson
A documentation ticket has been opened at qgis/QGIS-Documentation#9147
It is your responsibility to visit this ticket and add as much detail as possible for the documentation team to correctly document this change.
Thank you!

@zacharlie zacharlie added ChangelogHarvested This PR description has been harvested in the Changelog already. and removed Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ChangelogHarvested This PR description has been harvested in the Changelog already. Feature Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants