Skip to content

Commit

Permalink
pass account name as fallback user name for systems accepting layers …
Browse files Browse the repository at this point in the history
…without username / password and connections without password (e.g. Kerberos)
  • Loading branch information
signedav committed Oct 29, 2024
1 parent fb9a349 commit 70019d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
7 changes: 5 additions & 2 deletions QgisModelBaker/gui/panel/dataset_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
***************************************************************************/
"""

from qgis.core import QgsExpressionContextUtils, QgsProject
from qgis.core import QgsApplication, QgsExpressionContextUtils, QgsProject
from qgis.PyQt.QtCore import QSortFilterProxyModel, Qt
from qgis.PyQt.QtWidgets import QComboBox, QWidget

Expand Down Expand Up @@ -86,7 +86,10 @@ def set_current_layer(self, layer):
config_manager = db_factory.get_db_command_config_manager(configuration)
try:
db_connector = db_factory.get_db_connector(
config_manager.get_uri(), configuration.dbschema
config_manager.get_uri(
fallback_user=QgsApplication.userLoginName()
),
configuration.dbschema,
)
if db_connector.get_basket_handling():
self.basket_model.reload_schema_baskets(
Expand Down
9 changes: 0 additions & 9 deletions QgisModelBaker/gui/panel/pg_config_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,6 @@ def is_valid(self):
elif not self.pg_database_line_edit.text().strip():
message = self.tr("Please set a database before creating the project.")
self.pg_database_line_edit.setFocus()
elif (
not self.pg_auth_settings.username()
and not self.pg_auth_settings.configId()
):
message = self.tr(
"Please set a username or select an authentication configuration before creating the "
"project."
)
self.pg_auth_settings.setFocus()
elif (
self.pg_auth_settings.configId()
and not self.pg_use_super_login.isChecked()
Expand Down
5 changes: 4 additions & 1 deletion QgisModelBaker/gui/workflow_wizard/project_creation_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,10 @@ def _create_project(self):
self.configuration
)
uri = config_manager.get_uri(qgis=True)
mgmt_uri = config_manager.get_uri(self.configuration.db_use_super_login)
mgmt_uri = config_manager.get_uri(
su=self.configuration.db_use_super_login,
fallback_user=QgsApplication.userLoginName(),
)
generator = Generator(
self.configuration.tool,
uri,
Expand Down

0 comments on commit 70019d3

Please sign in to comment.