diff options
-rw-r--r-- | src/account/rsa.pem | 17 | ||||
-rw-r--r-- | src/account/rsa.pub | 6 | ||||
-rw-r--r-- | src/api/serializers.py | 7 | ||||
-rw-r--r-- | src/api/urls.py | 1 | ||||
-rw-r--r-- | src/api/views.py | 5 | ||||
-rw-r--r-- | src/booking/forms.py | 1 | ||||
-rw-r--r-- | src/dashboard/tasks.py | 2 | ||||
-rw-r--r-- | src/pharos_dashboard/settings.py | 4 | ||||
-rw-r--r-- | src/templates/account/user_list.html | 2 |
9 files changed, 18 insertions, 27 deletions
diff --git a/src/account/rsa.pem b/src/account/rsa.pem deleted file mode 100644 index dbd4eed..0000000 --- a/src/account/rsa.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALRiMLAh9iimur8V -A7qVvdqxevEuUkW4K+2KdMXmnQbG9Aa7k7eBjK1S+0LYmVjPKlJGNXHDGuy5Fw/d -7rjVJ0BLB+ubPK8iA/Tw3hLQgXMRRGRXXCn8ikfuQfjUS1uZSatdLB81mydBETlJ -hI6GH4twrbDJCR2Bwy/XWXgqgGRzAgMBAAECgYBYWVtleUzavkbrPjy0T5FMou8H -X9u2AC2ry8vD/l7cqedtwMPp9k7TubgNFo+NGvKsl2ynyprOZR1xjQ7WgrgVB+mm -uScOM/5HVceFuGRDhYTCObE+y1kxRloNYXnx3ei1zbeYLPCHdhxRYW7T0qcynNmw -rn05/KO2RLjgQNalsQJBANeA3Q4Nugqy4QBUCEC09SqylT2K9FrrItqL2QKc9v0Z -zO2uwllCbg0dwpVuYPYXYvikNHHg+aCWF+VXsb9rpPsCQQDWR9TT4ORdzoj+Nccn -qkMsDmzt0EfNaAOwHOmVJ2RVBspPcxt5iN4HI7HNeG6U5YsFBb+/GZbgfBT3kpNG -WPTpAkBI+gFhjfJvRw38n3g/+UeAkwMI2TJQS4n8+hid0uus3/zOjDySH3XHCUno -cn1xOJAyZODBo47E+67R4jV1/gzbAkEAklJaspRPXP877NssM5nAZMU0/O/NGCZ+ -3jPgDUno6WbJn5cqm8MqWhW1xGkImgRk+fkDBquiq4gPiT898jusgQJAd5Zrr6Q8 -AO/0isr/3aa6O6NLQxISLKcPDk2NOccAfS/xOtfOz4sJYM3+Bs4Io9+dZGSDCA54 -Lw03eHTNQghS0A== ------END PRIVATE KEY----- - diff --git a/src/account/rsa.pub b/src/account/rsa.pub deleted file mode 100644 index cc50e45..0000000 --- a/src/account/rsa.pub +++ /dev/null @@ -1,6 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0YjCwIfYoprq/FQO6lb3asXrx -LlJFuCvtinTF5p0GxvQGu5O3gYytUvtC2JlYzypSRjVxwxrsuRcP3e641SdASwfr -mzyvIgP08N4S0IFzEURkV1wp/IpH7kH41EtbmUmrXSwfNZsnQRE5SYSOhh+LcK2w -yQkdgcMv11l4KoBkcwIDAQAB ------END PUBLIC KEY----- diff --git a/src/api/serializers.py b/src/api/serializers.py index 1cc621a..10e1975 100644 --- a/src/api/serializers.py +++ b/src/api/serializers.py @@ -10,6 +10,7 @@ from rest_framework import serializers +from account.models import UserProfile from notifier.models import Notifier from booking.models import Booking from dashboard.models import Server, Resource, ResourceStatus @@ -44,3 +45,9 @@ class NotifierSerializer(serializers.ModelSerializer): class Meta: model = Notifier fields = ('id', 'title', 'content', 'user', 'sender', 'message_type', 'msg_sent') + +class UserSerializer(serializers.ModelSerializer): + username = serializers.CharField(source='user.username') + class Meta: + model = UserProfile + fields = ('user', 'username', 'ssh_public_key', 'pgp_public_key', 'email_addr') diff --git a/src/api/urls.py b/src/api/urls.py index 71cd3ef..c2cd510 100644 --- a/src/api/urls.py +++ b/src/api/urls.py @@ -34,6 +34,7 @@ router.register(r'servers', ServerViewSet) router.register(r'bookings', BookingViewSet) router.register(r'resource_status', ResourceStatusViewSet) router.register(r'notifier', NotifierViewSet) +router.register(r'user', UserViewSet) urlpatterns = [ url(r'^', include(router.urls)), diff --git a/src/api/views.py b/src/api/views.py index c16d57d..b873ef1 100644 --- a/src/api/views.py +++ b/src/api/views.py @@ -16,6 +16,7 @@ from rest_framework import viewsets from rest_framework.authtoken.models import Token from api.serializers import * +from account.models import UserProfile from booking.models import Booking from dashboard.models import Resource, Server, ResourceStatus @@ -45,6 +46,10 @@ class NotifierViewSet(viewsets.ModelViewSet): queryset = Notifier.objects.none() serializer_class = NotifierSerializer +class UserViewSet(viewsets.ModelViewSet): + queryset = UserProfile.objects.all() + serializer_class = UserSerializer + @method_decorator(login_required, name='dispatch') class GenerateTokenView(View): def get(self, request, *args, **kwargs): diff --git a/src/booking/forms.py b/src/booking/forms.py index b4acd8f..9d71b42 100644 --- a/src/booking/forms.py +++ b/src/booking/forms.py @@ -21,6 +21,7 @@ class BookingForm(forms.Form): reset = forms.ChoiceField(choices = ((True, 'Yes'),(False, 'No')), label="Reset System", initial='False', required=False) purpose = forms.CharField(max_length=300) opsys = forms.ModelChoiceField(queryset=Opsys.objects.all(), required=False) + opsys.label = "Operating System" installer = forms.ModelChoiceField(queryset=Installer.objects.all(), required=False) scenario = forms.ModelChoiceField(queryset=Scenario.objects.all(), required=False) diff --git a/src/dashboard/tasks.py b/src/dashboard/tasks.py index c5ef505..aab3345 100644 --- a/src/dashboard/tasks.py +++ b/src/dashboard/tasks.py @@ -14,11 +14,9 @@ from celery import shared_task from django.utils import timezone from jenkins.models import JenkinsStatistic -from notification.models import BookingNotification @shared_task def database_cleanup(): now = timezone.now() JenkinsStatistic.objects.filter(timestamp__lt=now - timedelta(weeks=4)).delete() - BookingNotification.objects.filter(submit_time__lt=now - timedelta(weeks=4)).delete()
\ No newline at end of file diff --git a/src/pharos_dashboard/settings.py b/src/pharos_dashboard/settings.py index 240f68e..361c4a1 100644 --- a/src/pharos_dashboard/settings.py +++ b/src/pharos_dashboard/settings.py @@ -5,7 +5,9 @@ from datetime import timedelta BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +# NOTE: os.environ only returns strings, so making a comparison to +# 'True' here will convert it to the correct Boolean value. +DEBUG = os.environ['DEBUG'] == 'True' # Application definition diff --git a/src/templates/account/user_list.html b/src/templates/account/user_list.html index 68178eb..58ddda6 100644 --- a/src/templates/account/user_list.html +++ b/src/templates/account/user_list.html @@ -22,7 +22,7 @@ {{ user.userprofile.full_name }} </td> <td> - {{ user.email }} + {{ user.userprofile.email_addr }} </td> <td> {{ user.userprofile.company }} |