Allow config without localsettings. Basic docker conf. Remove stale files.
[cas.git] / src / services / views.py
1 from django.contrib.auth.mixins import LoginRequiredMixin
2 from django.views.generic import DetailView, ListView
3 from .models import Service
4
5
6 class SshAuthorizedKeysView(DetailView):
7     model = Service
8     template_name = 'services/ssh_authorized_keys.txt'
9     content_type = 'text/plain'
10
11     def get_object(self):
12         obj = super().get_object()
13         if self.request.GET.get('key') != obj.key:
14             obj = None
15         return obj
16
17
18 class ServicesView(LoginRequiredMixin, ListView):
19     def get_queryset(self):
20         return Service.for_user(self.request.user)
21
22
23 class ServiceDetail(LoginRequiredMixin, DetailView):
24     def get_queryset(self):
25         return Service.for_user(self.request.user)