quick fix cmedb export share
parent
35fb7f298f
commit
105ad97947
|
@ -94,7 +94,7 @@ class DatabaseNavigator(cmd.Cmd):
|
|||
shares = self.db.get_shares()
|
||||
with open(os.path.expanduser(line[2]), 'w') as export_file:
|
||||
shareCSV = csv.writer(export_file, delimiter=";", quoting=csv.QUOTE_ALL, lineterminator='\n')
|
||||
csv_header = ["id","computerid","userid","name","remark","read","write"]
|
||||
csv_header = ["id","computer","userid","name","remark","read","write"]
|
||||
shareCSV.writerow(csv_header)
|
||||
#id|computerid|userid|name|remark|read|write
|
||||
for share in shares:
|
||||
|
@ -107,7 +107,7 @@ class DatabaseNavigator(cmd.Cmd):
|
|||
#id|computerid|userid|name|remark|read|write
|
||||
with open(os.path.expanduser(line[2]), 'w') as export_file:
|
||||
shareCSV = csv.writer(export_file, delimiter=";", quoting=csv.QUOTE_ALL, lineterminator='\n')
|
||||
csv_header = ["id","computerid","userid","name","remark","read","write"]
|
||||
csv_header = ["id","computer","userid","name","remark","read","write"]
|
||||
shareCSV.writerow(csv_header)
|
||||
for share in shares:
|
||||
shareid,hostname,userid,sharename,shareremark,read,write = share
|
||||
|
|
|
@ -666,7 +666,7 @@ class smb(connection):
|
|||
|
||||
if share_name != "IPC$":
|
||||
try:
|
||||
self.db.add_share(computer_id, self.host, share_name, share_remark, read, write)
|
||||
self.db.add_share(self.hostname, user_id, share_name, share_remark, read, write)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
|
@ -66,13 +66,12 @@ class database:
|
|||
|
||||
db_conn.execute('''CREATE TABLE "shares" (
|
||||
"id" integer PRIMARY KEY,
|
||||
"computerid" integer,
|
||||
"computerid" text,
|
||||
"userid" integer,
|
||||
"name" text,
|
||||
"remark" text,
|
||||
"read" boolean,
|
||||
"write" boolean,
|
||||
FOREIGN KEY(computerid) REFERENCES computers(id),
|
||||
FOREIGN KEY(userid) REFERENCES users(id)
|
||||
UNIQUE(computerid, userid, name)
|
||||
)''')
|
||||
|
|
|
@ -67,7 +67,7 @@ class navigator(DatabaseNavigator):
|
|||
|
||||
def display_shares(self, shares):
|
||||
|
||||
data = [["ShareID", "Name", "Remark", "Read Access", "Write Access"]]
|
||||
data = [["ShareID", "computer", "Name", "Remark", "Read Access", "Write Access"]]
|
||||
|
||||
for share in shares:
|
||||
|
||||
|
@ -88,7 +88,7 @@ class navigator(DatabaseNavigator):
|
|||
permissions='w'
|
||||
)
|
||||
|
||||
data.append([shareID, name, remark, f"{len(users_r_access)} User(s)", f"{len(users_w_access)} Users"])
|
||||
data.append([shareID, computerid, name, remark, f"{len(users_r_access)} User(s)", f"{len(users_w_access)} Users"])
|
||||
|
||||
self.print_table(data)
|
||||
|
||||
|
|
Loading…
Reference in New Issue