This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/channels/in_oauth/views/user.py

22 lines
797 B
Python
Raw Normal View History

2019-03-13 15:49:30 +00:00
"""passbook oauth_client user views"""
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import get_object_or_404
from django.views.generic import TemplateView
from passbook.channels.in_oauth.models import OAuthInlet, UserOAuthInletConnection
2019-03-13 15:49:30 +00:00
class UserSettingsView(LoginRequiredMixin, TemplateView):
"""Show user current connection state"""
2019-12-31 11:51:16 +00:00
template_name = "oauth_client/user.html"
2019-03-13 15:49:30 +00:00
def get_context_data(self, **kwargs):
inlet = get_object_or_404(OAuthInlet, slug=self.kwargs.get("inlet_slug"))
connections = UserOAuthInletConnection.objects.filter(
user=self.request.user, inlet=inlet
2019-12-31 11:51:16 +00:00
)
kwargs["inlet"] = inlet
2019-12-31 11:51:16 +00:00
kwargs["connections"] = connections
2019-03-13 15:49:30 +00:00
return super().get_context_data(**kwargs)