Remove API key From Console
parent
687acd6ece
commit
9389fff386
22
main.py
22
main.py
|
|
@ -66,7 +66,7 @@ async def database_get(get: CL.CL_Database_get,api_key: APIKey = Depends(auth.ge
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@app.post("/info/getvolume")
|
@app.post("/host/get/netvolume")
|
||||||
async def getvolume(get: CL.CL_GET_VOLUMES,api_key: APIKey = Depends(auth.get_api_key)):
|
async def getvolume(get: CL.CL_GET_VOLUMES,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
## Anpassung zum neune Schema erstellen
|
## Anpassung zum neune Schema erstellen
|
||||||
result = database(f"SELECT `Netzlaufwerk_1`,`Netzlaufwerk_2`,`Netzlaufwerk_3`,`Netzlaufwerk_4`,`Netzlaufwerk_5`,`Netzlaufwerk_6`,`Netzlaufwerk_7`,`Netzlaufwerk_8`,`Netzlaufwerk_9`,`Netzlaufwerk_10` FROM `Clients` where `Name` = '{get.name}'",f"{get.database}","")
|
result = database(f"SELECT `Netzlaufwerk_1`,`Netzlaufwerk_2`,`Netzlaufwerk_3`,`Netzlaufwerk_4`,`Netzlaufwerk_5`,`Netzlaufwerk_6`,`Netzlaufwerk_7`,`Netzlaufwerk_8`,`Netzlaufwerk_9`,`Netzlaufwerk_10` FROM `Clients` where `Name` = '{get.name}'",f"{get.database}","")
|
||||||
|
|
@ -86,16 +86,16 @@ async def getuser(get: CL.CL_GET_USER,api_key: APIKey = Depends(auth.get_api_key
|
||||||
else:
|
else:
|
||||||
return result[0][0]
|
return result[0][0]
|
||||||
|
|
||||||
@app.post("/info/gethost")
|
@app.post("/host/get")
|
||||||
async def gethostname(get: CL.CL_GET_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
async def gethost(get: CL.CL_GET_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
result = database(f"SELECT id FROM `hardware` where `hostname` = '{get.hostname}'",f"{get.dbname}","")
|
result = database(f"SELECT id FROM `hardware` where `hostname` = '{get.hostname}'",f"{get.dbname}","")
|
||||||
if not result:
|
if not result:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return result[0][0]
|
return result[0][0]
|
||||||
|
|
||||||
@app.post("/info/sethost")
|
@app.post("/host/set")
|
||||||
async def sethostname(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
async def sethost(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
database(f"INSERT INTO `{get.dbname}`.hardware (hostname,ipadresse,ram,hddused,hddfree,hddtotal) VALUES ('{get.hostname}','{get.ipadresse}','{get.ram}','{get.hddused}','{get.hddfree}','{get.hddtotal}')","","")
|
database(f"INSERT INTO `{get.dbname}`.hardware (hostname,ipadresse,ram,hddused,hddfree,hddtotal) VALUES ('{get.hostname}','{get.ipadresse}','{get.ram}','{get.hddused}','{get.hddfree}','{get.hddtotal}')","","")
|
||||||
result = database(
|
result = database(
|
||||||
f"SELECT id FROM `{get.dbname}`.hardware WHERE hostname = '{get.hostname}')",
|
f"SELECT id FROM `{get.dbname}`.hardware WHERE hostname = '{get.hostname}')",
|
||||||
|
|
@ -105,8 +105,8 @@ async def sethostname(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api
|
||||||
else:
|
else:
|
||||||
return result[0][0]
|
return result[0][0]
|
||||||
|
|
||||||
@app.post("/info/sethost_user")
|
@app.post("/user/set")
|
||||||
async def sethost_user(get: CL.CL_SET_HOST_USER,api_key: APIKey = Depends(auth.get_api_key)):
|
async def set_user(get: CL.CL_SET_HOST_USER,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
database(f"INSERT INTO `{get.dbname}`.user (user) VALUES ('{get.user}')","","")
|
database(f"INSERT INTO `{get.dbname}`.user (user) VALUES ('{get.user}')","","")
|
||||||
result = database(f"SELECT id FROM `{get.dbname}`.user WHERE user = '{get.user}'","","")
|
result = database(f"SELECT id FROM `{get.dbname}`.user WHERE user = '{get.user}'","","")
|
||||||
database(f"INSERT INTO `{get.dbname}`.hardware_to_user (userID,hardwareID) VALUES ('{result[0][0]}',{get.hardwareID})", "", "")
|
database(f"INSERT INTO `{get.dbname}`.hardware_to_user (userID,hardwareID) VALUES ('{result[0][0]}',{get.hardwareID})", "", "")
|
||||||
|
|
@ -115,16 +115,16 @@ async def sethost_user(get: CL.CL_SET_HOST_USER,api_key: APIKey = Depends(auth.g
|
||||||
else:
|
else:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@app.post("/info/gethost_user")
|
@app.post("/user/get")
|
||||||
async def gethost_user(get: CL.CL_GET_HOST_USER,api_key: APIKey = Depends(auth.get_api_key)):
|
async def get_user(get: CL.CL_GET_HOST_USER,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
result = database(f"SELECT id FROM `{get.dbname}`.user WHERE user = '{get.user}'","","")
|
result = database(f"SELECT id FROM `{get.dbname}`.user WHERE user = '{get.user}'","","")
|
||||||
if not result:
|
if not result:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return result[0][0]
|
return result[0][0]
|
||||||
|
|
||||||
@app.post("/info/setlastlogon_user")
|
@app.post("/user/set/lastlogon")
|
||||||
async def setlastlogon_user(get: CL.CL_SET_LASTLOGON_USER,api_key: APIKey = Depends(auth.get_api_key)):
|
async def set_lastlogon_user(get: CL.CL_SET_LASTLOGON_USER,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
database(f"INSERT INTO `{get.dbname}`.lastlogon (lastlogon) VALUES ('{get.lastlogon}')","","")
|
database(f"INSERT INTO `{get.dbname}`.lastlogon (lastlogon) VALUES ('{get.lastlogon}')","","")
|
||||||
lastlogonid = database(f"SELECT id FROM `{get.dbname}`.lastlogon WHERE lastlogon = '{get.lastlogon}'","","")
|
lastlogonid = database(f"SELECT id FROM `{get.dbname}`.lastlogon WHERE lastlogon = '{get.lastlogon}'","","")
|
||||||
result = database(f"INSERT INTO `{get.dbname}`.lastlogon_to_user (userID,lastlogonID) VALUES ('{get.userID}','{lastlogonid[0][0]}')", "", "")
|
result = database(f"INSERT INTO `{get.dbname}`.lastlogon_to_user (userID,lastlogonID) VALUES ('{get.userID}','{lastlogonid[0][0]}')", "", "")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue