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