updated control access
This commit is contained in:
29
py_app/check_users.py
Normal file
29
py_app/check_users.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import pymysql
|
||||
|
||||
try:
|
||||
# Connect to the database
|
||||
conn = pymysql.connect(
|
||||
host='localhost',
|
||||
database='trasabilitate',
|
||||
user='trasabilitate',
|
||||
password='Initial01!',
|
||||
cursorclass=pymysql.cursors.DictCursor
|
||||
)
|
||||
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute("SELECT id, username, role, modules FROM users")
|
||||
users = cursor.fetchall()
|
||||
|
||||
print("Current users in database:")
|
||||
print("-" * 50)
|
||||
for user in users:
|
||||
print(f"ID: {user['id']}")
|
||||
print(f"Username: {user['username']}")
|
||||
print(f"Role: {user['role']}")
|
||||
print(f"Modules: {user['modules']}")
|
||||
print("-" * 30)
|
||||
|
||||
finally:
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user