Einloggen funktioniert

This commit is contained in:
2024-12-03 16:30:56 +01:00
parent b028638d56
commit 7157176b5b
13 changed files with 804 additions and 50 deletions

32
lib/DB/UserDAO.py Normal file
View File

@@ -0,0 +1,32 @@
# This Python file uses the following encoding: utf-8
from .DbManager import DbManager
from ..PyqcrmFlags import PyqcrmFlags
import mariadb
class UserDAO:
def __init__(self):
self.__con = DbManager().getConnection()
self.__cur = self.__con.cursor()
def createUser(self, username, password, info, role= PyqcrmFlags.USER):
user_created = True
try:
self.__cur.callproc("createUser", (username, password, info, role))
self.__con.commit()
except mariadb.Error as e:
print(f"Error: {e}")
print(e.errno)
user_created = False
finally:
self.__closeConnection()
return user_created
def getUser(self, username):
self.__cur.callproc("getUser", (username,))
return self.__cur.fetchone()
def __closeConnection(self):
self.__cur.close()
self.__con.close()