Rapportsystem API - of D03N
Hovedprosjekt FiV Programmering 20-24
Loading...
Searching...
No Matches
new_user.py
Go to the documentation of this file.
1import os
2#Gets current directory
3current_directory = os.getcwd()
4#imports sys
5import sys
6sys.path.append(os.path.join(current_directory))
7
8#Imports SQLAdminConnections modules
9from SQLAdminConnections import SQL_CreateNewLeaderUser as save_leader
10from SQLAdminConnections import SQL_CreateNewOperatorUser as save_operator
11from SQLAdminConnections import SQL_CreateNewAdminUser as save_admin
12
13#Takes in user object and saves it to database
15 def __init__(self, email, password, key):
16 self.email = email
17 self.password = password
18 self.accountType = "admin"
19 self.databaseName = None
20 self.key = key
21
22 #saves user to database
23 def saveToDB(self):
24 if self.accountType == "admin":
25 save_admin.createNewAdminUser(self.email, self.password, self.accountType, self.key)
26 print("Admin account created successfully")
27 return True
28
29 else:
30 return False
__init__(self, email, password, key)
Definition new_user.py:15