|
|
@ -54,16 +54,12 @@ class Backup:
|
|
|
|
pass # empty tuple means everything
|
|
|
|
pass # empty tuple means everything
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
with open(fname, 'r', newline='') as f:
|
|
|
|
with open(fname, 'r', newline='') as f:
|
|
|
|
import lib.sqlitedb as sql
|
|
|
|
import lib.sqlitedb
|
|
|
|
import lib.System
|
|
|
|
import lib.System
|
|
|
|
sysctl = lib.System.System()
|
|
|
|
sysctl = lib.System.System()
|
|
|
|
sql = lib.sqlitedb.SQLitedb(CFG.REG_FILE)
|
|
|
|
sql = lib.sqlitedb.SQLitedb(CFG.REG_FILE)
|
|
|
|
reader = csv.DictReader(f) # @TODO csv.Sniffer to compare? When yes, give force-accept option
|
|
|
|
reader = csv.DictReader(f) # @TODO csv.Sniffer to compare? When yes, give force-accept option
|
|
|
|
for row in reader:
|
|
|
|
for row in reader:
|
|
|
|
sql.safequery("INSERT INTO `applications` (id, username, name, timestamp, email, pubkey, status) "
|
|
|
|
|
|
|
|
"VALUES (?,?,?,?,?,?,?)",
|
|
|
|
|
|
|
|
tuple([row["id"], row["username"], row["name"], row["timestamp"],
|
|
|
|
|
|
|
|
row["email"], row["pubkey"], row["status"]])) # @TODO: without IDs
|
|
|
|
|
|
|
|
if row["status"] == "1":
|
|
|
|
if row["status"] == "1":
|
|
|
|
sysctl.register(row["username"])
|
|
|
|
sysctl.register(row["username"])
|
|
|
|
sysctl.lock_user_pw(row["username"])
|
|
|
|
sysctl.lock_user_pw(row["username"])
|
|
|
@ -76,6 +72,10 @@ class Backup:
|
|
|
|
row['status'] + "not approved, therefore not registered.")
|
|
|
|
row['status'] + "not approved, therefore not registered.")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print(f"Uhm, ok. Type is {type(row['status'])}, and value is {row['status']}")
|
|
|
|
print(f"Uhm, ok. Type is {type(row['status'])}, and value is {row['status']}")
|
|
|
|
|
|
|
|
sql.safequery("INSERT INTO `applications` (username, name, timestamp, email, pubkey, status) "
|
|
|
|
|
|
|
|
"VALUES (?,?,?,?,?,?)",
|
|
|
|
|
|
|
|
tuple([row["username"], row["name"], row["timestamp"],
|
|
|
|
|
|
|
|
row["email"], row["pubkey"], row["status"]])) # @TODO: without IDs
|
|
|
|
pass # @TODO: Import with sqlitedb and system. Will be fun Kappa
|
|
|
|
pass # @TODO: Import with sqlitedb and system. Will be fun Kappa
|
|
|
|
except OSError as E:
|
|
|
|
except OSError as E:
|
|
|
|
print(f"UUFFF, something went WRONG with the file {fname}: {E}")
|
|
|
|
print(f"UUFFF, something went WRONG with the file {fname}: {E}")
|
|
|
|