Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructuring of the folders according to "Entwurfsheft" #40

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions quafelweb/account_controller/authenticate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def get_identifier(self, request):
def is_logged_in(self, request):
raise NotImplementedError()


def RegisterInstance(name : str, auth : "BaseAuthenticator"):
BaseAuthenticator._AUTHENTICATORS[name] = auth

Expand Down
17 changes: 0 additions & 17 deletions quafelweb/account_controller/kitopenid.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,5 @@ def get_identifier(self, request):

def is_logged_in(self, request):
return 'user_info' in request.session


@receiver(token_update)
def on_token_update(self, sender, name, token, refresh_token=None, access_token=None, **kwargs):
if refresh_token:
item = self.oauth.find(name=name, refresh_token=refresh_token)
elif access_token:
item = self.oauth.find(name=name, access_token=access_token)
else:
return

# update old token
item.access_token = token['access_token']
item.refresh_token = token.get('refresh_token')
item.expires_at = token['expires_at']
item.save()


authenticate.BaseAuthenticator.RegisterInstance("kitopenid", KITOpenIDAuth())
4 changes: 2 additions & 2 deletions quafelweb/account_controller/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import account_controller.kitopenid # This needs to be here
from account_controller import authenticate
from account_controller.models import QuafelAdmin
from account_controller.models import AdminAccount
# Create your views here.

class AccountManager():
Expand All @@ -20,7 +20,7 @@ def _deco(req):
if not AccountManager._AUTH.is_logged_in(req):
return AccountManager._AUTH.authenticate(req, req.build_absolute_uri(reverse('auth')))
ident = AccountManager._AUTH.get_identifier(req)
if QuafelAdmin.objects.contains(QuafelAdmin(ident)):
if AdminAccount.objects.contains(AdminAccount(ident)):
return redirect('denied')
return fn(req)

Expand Down
22 changes: 18 additions & 4 deletions quafelweb/account_controller/views.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@


from django.http import HttpResponse


class AccountView:

# /
def index(request):
def manage_accounts(request) -> HttpResponse:
...

def add_admin(request):
def add_admin(request) -> HttpResponse:
...

def remove_admin(request) -> HttpResponse:
...

def authenticate(request) -> HttpResponse:
...

def authenticate_callback(requests) -> HttpResponse:
...

def get_identifier(request) -> str:
...

def remove_admin(request):
def is_logged_in(request) -> bool:
...
5 changes: 1 addition & 4 deletions quafelweb/hardware_controller/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class HardwareView:

# /hardware
def index(request):
def manage_controllers(request):
...

# /hardware/add with post
Expand All @@ -20,8 +20,5 @@ def remove_profile(request):
def archive_profile(request):
...

# return List of HardwareProfile Ids connected with the request (persistent Links)
def getConst(request):
...


1 change: 1 addition & 0 deletions quafelweb/quafel_simulators/backend/gpu-cluster.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from quafel_simulators.simulator import
6 changes: 3 additions & 3 deletions quafelweb/quafel_simulators/simulator.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from abc import ABC
from simulation_data.simulation import SimulationGroup
from simulation_data.simulation import SimulationGroup, HardwareProfile


class Simulator(ABC):

def simulate(self, group : SimulationGroup):
def simulate(self, ip : str, port : int , simulators : list[str], qbits : set[int], ...):
...

def collect(self) -> dict:
...
...
2 changes: 2 additions & 0 deletions quafelweb/simulation_controller/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ def select_environments(request):
def submit_request(request):
...

def claim_results(request):
...
6 changes: 0 additions & 6 deletions quafelweb/simulation_view/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,3 @@ def render_view(request, sim_envs : list[SimulationEnv], sim_confs : dict[str, l
context = { 'environments' : sim_envs }

return render(request, 'index.html', context)


# return Integers of Simulation Data already in database
def getRunnedData(request):
...

Loading