Commit e42e3172 authored by Manuel's avatar Manuel

changed business-logic-scripts to fetch admin tokens

parent b47868c5
......@@ -23,10 +23,11 @@ class TokenManager:
def getToken(self, admin=False) -> str:
if self._token == None:
credentials_path = get_resources_path()
credentials_path = f"{credentials_path}/{'admin' if admin else 'regular'}_user_credentials.json"
print("Looking for credentials at ... "+str(credentials_path))
print(f"Looking for credentials at '{credentials_path}'")
with open(f"{credentials_path}/{'admin' if admin else 'regular'}_user_credentials.json") as file_handler:
with open(credentials_path) as file_handler:
credentials = json.loads(file_handler.read())
url = f'https://{network_constants.REST_GATEWAY_HOSTNAME}:{network_constants.REST_GATEWAY_REST_PORT}/api/tokens'
......
......@@ -15,7 +15,7 @@ import tables.add_bank_app as add_bank_app
def add_use_case(use_case: str):
jwt = TokenManager.getInstance().getToken()
jwt = TokenManager.getInstance().getToken(admin=True)
url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
response = requests.post(
url,
......
......@@ -9,17 +9,8 @@ for modules_path in modules_paths:
if os.path.exists(modules_path):
sys.path.insert(1, modules_path)
# import _add_use_case_scripts.car_sharing.tables.add_user as user
from _add_use_case_scripts.car_sharing.tables import add_car, add_hash, add_offer, add_publication, add_travel, add_user
# import _add_use_case_scripts.car_sharing.tables.add_user as user
# from _add_use_case_scripts.car_sharing.tables import add_car
# from _add_use_case_scripts.car_sharing.tables import add_hash
# from _add_use_case_scripts.car_sharing.tables import add_publication
# from _add_use_case_scripts.car_sharing.tables import add_offer
# from _add_use_case_scripts.car_sharing.tables import add_travel
import network_constants as nc
from security.token_manager import TokenManager
......@@ -28,7 +19,7 @@ from security.token_manager import TokenManager
def add_use_case(use_case: str):
use_case = "car-sharing"
jwt = TokenManager.getInstance().getToken()
jwt = TokenManager.getInstance().getToken(admin=True)
url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
response = requests.post(
url,
......
......@@ -22,7 +22,7 @@ from security.token_manager import TokenManager
def add_use_case(use_case: str):
use_case = "car-sharing-official"
jwt = TokenManager.getInstance().getToken()
jwt = TokenManager.getInstance().getToken(admin=True)
url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
response = requests.post(
url,
......
......@@ -14,7 +14,7 @@ from security.token_manager import TokenManager
import tables.add_table as add_table
def add_use_case(use_case: str):
jwt = TokenManager.getInstance().getToken()
jwt = TokenManager.getInstance().getToken(admin=True)
url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
response = requests.post(
url,
......
......@@ -14,7 +14,7 @@ from security.token_manager import TokenManager
import tables.add_table as add_table
def add_use_case(use_case: str):
jwt = TokenManager.getInstance().getToken()
jwt = TokenManager.getInstance().getToken(admin=True)
url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
response = requests.post(
url,
......
......@@ -16,7 +16,7 @@ from security.token_manager import TokenManager
def add_use_case(use_case: str):
jwt = TokenManager.getInstance().getToken()
jwt = TokenManager.getInstance().getToken(admin=True)
url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
response = requests.post(
url,
......
......@@ -53,7 +53,7 @@ def add_layers(use_case:str, table_name: str):
"UniqueID",
"objecttype",
"eventid",
"evenEpicenter",
"eventEpicenter",
"range",
"firstTag"
],
......
......@@ -14,7 +14,7 @@ from security.token_manager import TokenManager
import tables.add_pizza_table as pizza
def add_use_case(use_case: str):
jwt = TokenManager.getInstance().getToken()
jwt = TokenManager.getInstance().getToken(admin=True)
url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
response = requests.post(
url,
......
......@@ -14,7 +14,7 @@ from security.token_manager import TokenManager
import tables.add_reddit as reddit
def add_use_case(use_case: str):
jwt = TokenManager.getInstance().getToken()
jwt = TokenManager.getInstance().getToken(admin=True)
url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
response = requests.post(
url,
......
......@@ -14,7 +14,7 @@ from security.token_manager import TokenManager
import tables.add_smart_energy as smart_energy
def add_use_case(use_case: str):
jwt = TokenManager.getInstance().getToken()
jwt = TokenManager.getInstance().getToken(admin=True)
url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
response = requests.post(
url,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment