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

Concern superuser login on receiving schema #969

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions QgisModelBaker/gui/panel/pg_config_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
import logging
from enum import IntEnum

from qgis.PyQt.QtCore import Qt, QThread, QTimer
from qgis.PyQt.QtCore import QSettings, Qt, QThread, QTimer

import QgisModelBaker.libs.modelbaker.utils.db_utils as db_utils
from QgisModelBaker.libs.modelbaker.iliwrapper.globals import DbIliMode
from QgisModelBaker.libs.modelbaker.iliwrapper.ili2dbconfig import (
BaseConfiguration,
Ili2DbCommandConfiguration,
)
from QgisModelBaker.libs.modelbaker.utils.globals import DbActionType
Expand Down Expand Up @@ -68,15 +69,17 @@ def __init__(self, parent, db_action_type):
self._read_pg_schemas_task = ReadPgSchemasTask(self)
self._read_pg_schemas_task.finished.connect(self._read_pg_schemas_task_finished)

from QgisModelBaker.libs.modelbaker.iliwrapper.ili2dbconfig import (
BaseConfiguration,
)
self.base_config = BaseConfiguration()
settings = QSettings()
settings.beginGroup("QgisModelBaker/ili2db")
self.base_config.restore(settings)

self.pg_use_super_login.setText(
self.tr(
"Execute data management tasks with superuser login from settings ({})"
).format(BaseConfiguration().super_pg_user)
).format(self.base_config.super_pg_user)
)

self.pg_use_super_login.setToolTip(
self.tr(
"Data management tasks are <ul><li>Create the schema</li><li>Read meta information</li><li>Import data from XTF</li></ul>"
Expand Down Expand Up @@ -112,6 +115,8 @@ def __init__(self, parent, db_action_type):
self.pg_auth_settings.passwordChanged.connect(self._fields_modified)
self.pg_auth_settings.configIdChanged.connect(self._fields_modified)

self.pg_use_super_login.stateChanged.connect(self._fields_modified)

# Fill pg_services combo box
self.pg_service_combo_box.addItem(self.tr("None"), None)
services, _ = db_utils.get_service_names()
Expand Down Expand Up @@ -521,6 +526,7 @@ def _fill_schema_combo_box(self):
return

configuration = Ili2DbCommandConfiguration()
configuration.base_configuration = self.base_config
self.get_fields(configuration)
configuration.tool = DbIliMode.pg

Expand Down