Commit 2038fdda authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Fix the broken import paths

parent db04b3d1
......@@ -2,8 +2,8 @@ from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import Group
from . import models, broker_models
from .auth.v1.models import OIDCConfig
from .models import models, brokers as broker_models
class TypeFilter(admin.SimpleListFilter):
......
import logging
import json
from urllib.request import Request, urlopen
from django.db import models as db_models
from django_mysql.models import JSONField
from oic.oic import Client
from oic.oic.message import RegistrationResponse
from oic.utils.authn.client import CLIENT_AUTHN_METHOD
from ... import models
from . import utils
LOGGER = logging.getLogger(__name__)
......@@ -112,13 +114,15 @@ class OIDCTokenAuthBackend(object):
access_token=token,
)
return models.User.get_user(
from ...models.users import User
return User.get_user(
userinfo,
oidc_client,
)
def get_user(self, user_id):
query = models.User.objects.filter(
from ...models.users import User
query = User.objects.filter(
user_type='oidcuser',
pk=user_id
)
......
from django.conf.urls import url
from django.views.decorators.csrf import csrf_exempt
from . import views, client_views
from .views import webpage, clients
URLPATTERNS = [
url(r'^info', views.AuthInfo.as_view()),
url(r'^request', views.Auth.as_view()),
url(r'^callback', views.AuthCallback.as_view()),
url(r'^logout', views.LogoutView.as_view()),
url(r'^client/user', csrf_exempt(client_views.user_endpoint)),
url(r'^client/vhost', csrf_exempt(client_views.vhost_endpoint)),
url(r'^client/resource', csrf_exempt(client_views.resource_endpoint)),
url(r'^client/topic', csrf_exempt(client_views.topic_endpoint)),
url(r'^info', webpage.AuthInfo.as_view()),
url(r'^request', webpage.Auth.as_view()),
url(r'^callback', webpage.AuthCallback.as_view()),
url(r'^logout', webpage.LogoutView.as_view()),
url(r'^client/user', csrf_exempt(clients.user_endpoint)),
url(r'^client/vhost', csrf_exempt(clients.vhost_endpoint)),
url(r'^client/resource', csrf_exempt(clients.resource_endpoint)),
url(r'^client/topic', csrf_exempt(clients.topic_endpoint)),
]
import logging
import re
from django.contrib.auth.models import AbstractUser, Group
from django.contrib.auth.models import Group
from django.http import HttpResponse
from django.contrib.auth import authenticate
from django.contrib.sessions.models import Session
from ...models import Site, User
from ...broker_models import RabbitMQInstance
from ....models.models import Site
from ....models.brokers import RabbitMQInstance
from ....models.users import User
LOGGER = logging.getLogger(__name__)
CLIENT_DEBUGGING = False
......
import json
import logging
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import redirect
from django.views import View
from oic import rndstr
from oic.oic.message import AuthorizationResponse
from rest_framework import generics, views
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from oic import rndstr
from oic.oic.message import AuthorizationResponse
from .models import OIDCConfig, default_idp
from .serializers import AuthInfoSerializer
from . import utils
from ...frontend.views import state_view_data
from .. import utils
from ..models import OIDCConfig, default_idp
from ..serializers import AuthInfoSerializer
from ....views.webpage import state_view_data
LOGGER = logging.getLogger(__name__)
......
......@@ -9,7 +9,7 @@ from polymorphic.models import PolymorphicModel
from rest_framework import serializers
from rest_polymorphic.serializers import PolymorphicSerializer
from .user_models import User
from .users import User
LOGGER = getLogger(__name__)
......
from json import dumps
from logging import getLogger
from django.contrib.auth.models import Group
from django.db import models
from django_mysql.models import JSONField
from .broker_models import RabbitMQInstance
from .user_models import User
from .brokers import RabbitMQInstance
from .users import User
LOGGER = getLogger(__name__)
......@@ -496,7 +497,7 @@ class DeploymentState(models.Model):
def publish_to_client(self):
# mitigating circular dependencies here
from .clientapi.serializers import DeploymentStateSerializer
from .serializers.clients import DeploymentStateSerializer
msg = dumps(DeploymentStateSerializer(self).data)
if self.service is not None:
......@@ -515,7 +516,7 @@ class DeploymentState(models.Model):
# update the state of the remote webpage
def publish_to_user(self):
if self.user is not None:
from .frontend.views import user_state
from ..views.webpage import user_state
msg = dumps({
'user_state': user_state(self.user),
})
......
......@@ -3,7 +3,11 @@
from django_mysql.models import JSONField
from rest_framework import serializers
from .. import models, broker_models, serializers as backend_serializers
from .. import models
from ..users import User
from ..brokers import RabbitMQInstance
from .serializers import GroupSerializer, SSHPublicKeySerializer
class ServiceSerializer(serializers.ModelSerializer):
......@@ -15,18 +19,18 @@ class ServiceSerializer(serializers.ModelSerializer):
class UserSerializer(serializers.ModelSerializer):
groups = backend_serializers.GroupSerializer(many=True)
groups = GroupSerializer(many=True)
userinfo = JSONField()
class Meta:
model = models.User
model = User
fields = ['email', 'groups', 'userinfo']
class DeploymentSerializer(serializers.ModelSerializer):
user = UserSerializer()
service = ServiceSerializer()
ssh_keys = backend_serializers.SSHPublicKeySerializer(many=True)
ssh_keys = SSHPublicKeySerializer(many=True)
#ssh_keys_to_remove = backend_serializers.SSHPublicKeySerializer(many=True)
class Meta:
......@@ -49,9 +53,9 @@ class DeploymentsSerializer(serializers.Serializer):
class DeploymentStateSerializer(serializers.ModelSerializer):
user = UserSerializer()
key = backend_serializers.SSHPublicKeySerializer()
key = SSHPublicKeySerializer()
service = ServiceSerializer()
group = backend_serializers.GroupSerializer()
group = GroupSerializer()
class Meta:
model = models.DeploymentState
......@@ -72,5 +76,5 @@ class SiteSerializer(serializers.Serializer):
class RabbitMQInstanceSerializer(serializers.ModelSerializer):
class Meta:
model = broker_models.RabbitMQInstance
model = RabbitMQInstance
fields = ['vhost']
......@@ -3,7 +3,8 @@
from django.contrib.auth.models import Group
from rest_framework import serializers
from .models import SSHPublicKey
from ..models import SSHPublicKey
class GroupSerializer(serializers.ModelSerializer):
......
......@@ -2,7 +2,10 @@
# pylint: disable=abstract-method
from rest_framework import serializers
from .. import models, serializers as backend_serializers
from .. import models
from ..users import User
from . import serializers as backend_serializers
class SiteSerializer(serializers.ModelSerializer):
......@@ -95,7 +98,7 @@ class UserSerializer(serializers.ModelSerializer):
ssh_keys = backend_serializers.SSHPublicKeySerializer(many=True)
class Meta:
model = models.User
model = User
fields = [
'profile_name',
'groups',
......@@ -112,7 +115,7 @@ class UserStateSerializer(serializers.ModelSerializer):
deployments = DeploymentSerializer(many=True)
class Meta:
model = models.User
model = User
fields = [
'deployment_state_items',
'deployment_states',
......
......@@ -5,7 +5,7 @@ from django.contrib import auth
from django.contrib.auth.models import Group
from django.test import TestCase
from django_backend.backend import models
from django_backend.backend.models import models
from django_backend.backend.auth.v1 import models as auth_models
LOGGER = logging.getLogger(__name__)
......
......@@ -8,10 +8,8 @@ from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django_mysql.models import JSONField
from polymorphic.models import PolymorphicModel
from rest_polymorphic.serializers import PolymorphicSerializer
from .auth.v1.models import OIDCConfig
from ..auth.v1.models import OIDCConfig
LOGGER = logging.getLogger(__name__)
......
from django.conf.urls import include, url
from django.contrib import admin
from .clientapi.urls import URLPATTERNS as clientapi_urls
from .frontend.urls import URLPATTERNS as frontend_urls
from .views.client_urls import URLPATTERNS as clientapi_urls
from .views.webpage_urls import URLPATTERNS as frontend_urls
from .auth.v1.urls import URLPATTERNS as auth_urls
URLPATTERNS = [
......
from django.conf.urls import url
from . import clients
URLPATTERNS = [
url(r'^deployments', clients.DeploymentsView.as_view()),
url(r'^config', clients.ConfigurationView.as_view()),
url(r'^response', clients.ResponseView.as_view()),
]
import json
import logging
from django.contrib.auth.models import Group
from rest_framework import generics, views
from rest_framework.authentication import BasicAuthentication
from rest_framework.response import Response
from .serializers import DeploymentStateSerializer, ServiceSerializer, RabbitMQInstanceSerializer
from ..broker_models import RabbitMQInstance
from .. import models
from ..models.brokers import RabbitMQInstance
from ..models.serializers.webpage import DeploymentStateSerializer
from ..models.serializers.clients import RabbitMQInstanceSerializer
from ..models import models
LOGGER = logging.getLogger(__name__)
......@@ -30,7 +32,7 @@ class ConfigurationView(views.APIView):
authentication_classes = AUTHENTICATION_CLASSES
def put(self, request):
services = request.data.get('services', None)
#services = request.data.get('services', None)
group_to_services = request.data.get('group_to_services', None)
# TODO check if client has new services
......
from django.conf.urls import url
from . import views
URLPATTERNS = [
url(r'^deployments', views.DeploymentsView.as_view()),
url(r'^config', views.ConfigurationView.as_view()),
url(r'^response', views.ResponseView.as_view()),
]
from .. import test_models
from django.contrib import auth
from django.test import Client
from django.test import TestCase
from ..models import test_models
class ViewTest(TestCase):
def setUp(self):
......
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