Template
forked from CEN-RA/Plugin_QGIS
Mise à jour de sécurité
This commit is contained in:
@@ -26,9 +26,11 @@ from pg_metadata.qgis_plugin_tools.tools.custom_logging import setup_logger
|
||||
import os
|
||||
from .tools.resources import (
|
||||
plugin_path,
|
||||
pyperclip,
|
||||
resources_path,
|
||||
maj_verif,
|
||||
)
|
||||
pyperclip()
|
||||
from .dock import CenRa_Metabase
|
||||
from .editor import Metabase_Editor
|
||||
from .about_form import MetabaseAboutDialog
|
||||
|
||||
@@ -47,7 +47,7 @@ from pg_metadata.connection_manager import (
|
||||
settings_connections_names,
|
||||
)
|
||||
'''
|
||||
from CenRa_METABASE.tools.PythonSQL import login_base
|
||||
from .tools.PythonSQL import login_base
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
|
||||
@@ -38,7 +38,7 @@ from qgis.PyQt.QtWidgets import (
|
||||
)
|
||||
from qgis.utils import iface
|
||||
|
||||
from CenRa_METABASE.tools.PythonSQL import login_base
|
||||
from .tools.PythonSQL import login_base
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
name=CenRa_Metabase
|
||||
qgisMinimumVersion=3.0
|
||||
description=CenRa_METABASE
|
||||
version=0.2.0
|
||||
version=0.2.1
|
||||
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
|
||||
email=si_besoin@cen-rhonealpes.fr
|
||||
|
||||
@@ -21,7 +21,7 @@ tracker=https://gitea.cenra-outils.org/api/v1/repos/CEN-RA/Plugin_QGIS/issues
|
||||
|
||||
hasProcessingProvider=no
|
||||
# Uncomment the following line and add your changelog:
|
||||
changelog=<h2>CenRa_Metabase:</h2></br><p><h3>07/01/2025 - Version 0.1.6: </h3> - Deployment sur serveur SIG.</p></br><p><h3>07/01/2025 - Version 0.1.6: </h3> - ByPass du certif ssl ci erreur</p></br><p><h3>19/12/2024 - Version 0.1.5: </h3> - Fix les problem de lenteur qu'en la base est down.</p></br><p><h3>12/12/2024 - Version 0.1.4: </h3> - Crash Fix .</p></br><p><h3>08/10/2024 - Version 0.1.3: </h3> - Lecture de métadonnée des flux WMS/WFS.</p></br><p><h3>07/10/2024 - Version 0.1.2: </h3> - Correctif de bug.</p></br><p><h3>03/10/2024 - Version 0.1.1: </h3> - Remonte la fênetre dans la pille.</p></br><p><h3>26/08/2024 - Version 0.1.0: </h3> - Lancement du plugin CenRa_Metabase </p>
|
||||
changelog=<h2>CenRa_METABASE:</h2></br><p><h3>03/04/2025 - Version 0.2.1: </h3> - Mise a jour de securite.</p></br><p><h3>07/01/2025 - Version 0.2.0: </h3> - Deployment sur serveur SIG.</p></br><p><h3>07/01/2025 - Version 0.1.6: </h3> - ByPass du certif ssl ci erreur</p></br><p><h3>19/12/2024 - Version 0.1.5: </h3> - Fix les problem de lenteur qu'en la base est down.</p></br><p><h3>12/12/2024 - Version 0.1.4: </h3> - Crash Fix .</p></br><p><h3>08/10/2024 - Version 0.1.3: </h3> - Lecture de métadonnée des flux WMS/WFS.</p></br><p><h3>07/10/2024 - Version 0.1.2: </h3> - Correctif de bug.</p></br><p><h3>03/10/2024 - Version 0.1.1: </h3> - Remonte la fênetre dans la pille.</p></br><p><h3>26/08/2024 - Version 0.1.0: </h3> - Lancement du plugin CenRa_Metabase </p>
|
||||
|
||||
# Tags are comma separated with spaces allowed
|
||||
tags=python
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
import sys
|
||||
import socket
|
||||
import os
|
||||
import base64
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
|
||||
IPAddr=socket.gethostbyname(socket.gethostname())
|
||||
#print(IPAddr)
|
||||
if IPAddr[0:11] == "100.100.100": #4269
|
||||
host = "100.100.100.11"
|
||||
port = "5432"
|
||||
dbname = "sig4269"
|
||||
sigdb="sig4269"
|
||||
refdb="ref_geo4269"
|
||||
password = "McVities"
|
||||
if IPAddr[0:9] == "192.168.0": #01
|
||||
host = "192.168.0.201"
|
||||
port = "5432"
|
||||
dbname = "sig01"
|
||||
sigdb="sig01"
|
||||
refdb="ref_geo01"
|
||||
password = "McVities"
|
||||
if IPAddr[0:9] == "192.168.1": #0726
|
||||
host = "192.168.1.201"
|
||||
port = "5432"
|
||||
dbname = "sig0726"
|
||||
sigdb="sig0726"
|
||||
refdb="ref_geo0726"
|
||||
password = "McVities"
|
||||
if sys.platform == 'linux':
|
||||
os_user = os.environ['USER']
|
||||
else:
|
||||
os_user = os.environ['USERNAME']
|
||||
if os_user == 'STAGE':
|
||||
os_user='stage'
|
||||
if os_user == 'Administrateur':
|
||||
os_user='stage'
|
||||
|
||||
def login_base(take=None):
|
||||
first_conn = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=first_cnx password=" + password)
|
||||
first_cur = first_conn.cursor(cursor_factory = psycopg2.extras.DictCursor)
|
||||
first_cur.execute("SELECT mdp_w, login_w FROM pg_catalog.pg_user t1, admin_sig.vm_users_sig t2 WHERE t2.oid = t1.usesysid AND (login_w = '" + os_user + "' OR login_w = '" + os_user + "')")
|
||||
res_ident = first_cur.fetchone()
|
||||
|
||||
mdp = base64.b64decode(str(res_ident[0])).decode('utf-8')
|
||||
user = res_ident[1]
|
||||
|
||||
con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
|
||||
|
||||
cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
|
||||
first_conn.close()
|
||||
|
||||
if take:
|
||||
return cur,con
|
||||
else:
|
||||
return cur
|
||||
@@ -3,6 +3,7 @@
|
||||
import configparser
|
||||
import shutil
|
||||
import tempfile
|
||||
import socket
|
||||
from os.path import abspath, join, pardir, dirname
|
||||
from qgis.PyQt.QtWidgets import QApplication
|
||||
from qgis.PyQt import uic
|
||||
@@ -91,6 +92,19 @@ def resources_path(*args):
|
||||
path = abspath(join(path, item))
|
||||
return path
|
||||
|
||||
def pyperclip():
|
||||
IPAddr=socket.gethostbyname(socket.gethostname())
|
||||
dst = abspath(abspath(join(plugin_path(), "CenRa_METABASE\\tools\\")))
|
||||
if IPAddr[0:11] == "100.100.100": #4269
|
||||
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
|
||||
if IPAddr[0:9] == "192.168.0": #01
|
||||
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
|
||||
if IPAddr[0:9] == "192.168.1": #0726
|
||||
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
|
||||
try:
|
||||
shutil.copy(src, dst)
|
||||
except:
|
||||
print('404')
|
||||
|
||||
def load_ui(*args):
|
||||
"""Get compile UI file.
|
||||
|
||||
Reference in New Issue
Block a user