plain.oauth 0.8.0__py3-none-any.whl → 0.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- from plain.models import Count
2
- from plain.staff.cards import ChartCard
3
- from plain.staff.views import (
4
- StaffModelDetailView,
5
- StaffModelListView,
6
- StaffViewset,
1
+ from plain.admin.cards import ChartCard
2
+ from plain.admin.views import (
3
+ AdminModelDetailView,
4
+ AdminModelListView,
5
+ AdminViewset,
7
6
  register_viewset,
8
7
  )
8
+ from plain.models import Count
9
9
 
10
10
  from .models import OAuthConnection
11
11
 
@@ -34,14 +34,14 @@ class ProvidersChartCard(ChartCard):
34
34
 
35
35
 
36
36
  @register_viewset
37
- class OAuthConnectionViewset(StaffViewset):
38
- class ListView(StaffModelListView):
37
+ class OAuthConnectionViewset(AdminViewset):
38
+ class ListView(AdminModelListView):
39
39
  nav_section = "OAuth"
40
40
  model = OAuthConnection
41
41
  title = "Connections"
42
42
  fields = ["id", "user", "provider_key", "provider_user_id"]
43
43
  cards = [ProvidersChartCard]
44
44
 
45
- class DetailView(StaffModelDetailView):
45
+ class DetailView(AdminModelDetailView):
46
46
  model = OAuthConnection
47
47
  title = "OAuth connection"
plain/oauth/models.py CHANGED
@@ -18,6 +18,7 @@ if TYPE_CHECKING:
18
18
  # TODO preflight check for deploy that ensures all provider keys in db are also in settings?
19
19
 
20
20
 
21
+ @models.register_model
21
22
  class OAuthConnection(models.Model):
22
23
  created_at = models.DateTimeField(auto_now_add=True)
23
24
  updated_at = models.DateTimeField(auto_now=True)
plain/oauth/providers.py CHANGED
@@ -95,7 +95,7 @@ class OAuthProvider:
95
95
  return self.scope
96
96
 
97
97
  def get_callback_url(self, *, request: HttpRequest) -> str:
98
- url = reverse("oauth:callback", kwargs={"provider": self.provider_key})
98
+ url = reverse("oauth:callback", provider=self.provider_key)
99
99
  return request.build_absolute_uri(url)
100
100
 
101
101
  def generate_state(self) -> str:
plain/oauth/urls.py CHANGED
@@ -1,13 +1,14 @@
1
- from plain.urls import include, path
1
+ from plain.urls import RouterBase, include, path, register_router
2
2
 
3
3
  from . import views
4
4
 
5
- default_namespace = "oauth"
6
5
 
7
- urlpatterns = [
8
- path(
9
- "<str:provider>/",
6
+ @register_router
7
+ class Router(RouterBase):
8
+ namespace = "oauth"
9
+ urls = [
10
10
  include(
11
+ "<str:provider>/",
11
12
  [
12
13
  # Login and Signup are both handled here, because the intent is the same
13
14
  path("login/", views.OAuthLoginView, name="login"),
@@ -18,7 +19,6 @@ urlpatterns = [
18
19
  name="disconnect",
19
20
  ),
20
21
  path("callback/", views.OAuthCallbackView, name="callback"),
21
- ]
22
+ ],
22
23
  ),
23
- ),
24
- ]
24
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.oauth
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: OAuth login and API access for Plain.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -1,12 +1,12 @@
1
1
  plain/oauth/README.md,sha256=RWGb-KlcYm6etIKAgypE7qqzmgRWskAaVdKxfrXybV8,9901
2
2
  plain/oauth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ plain/oauth/admin.py,sha256=rqrGRRUVxOlG9wiuXtndIyQxd1VT67cvFy6qWo7LF-Q,1278
3
4
  plain/oauth/config.py,sha256=jk5l59taT_3Kh7EFrJuuubtrCHLfNBVkD2sWQ_M5_JQ,160
4
5
  plain/oauth/default_settings.py,sha256=dlN1J9vSOjjxPNLp-0qe-cLTqwM4E69ZAx_8lpxMhaM,28
5
6
  plain/oauth/exceptions.py,sha256=TMGtIGkK3_J4rsEy1oPCmia7BnRSK8N8RMZm4_pNelA,189
6
- plain/oauth/models.py,sha256=JKST_orOFzywvtoQbrTO9cn7lKLJgjaBUJTN9RqXw7c,6843
7
- plain/oauth/providers.py,sha256=CqZg5pkB7yLK2Fkbc3dpY9ioYeh5tVoEuiJf1qn1qDM,7150
8
- plain/oauth/staff.py,sha256=3RvJEFGVQ9gbVDi0d_EphrQg0NpwuS4YKOqIMMmj9q4,1278
9
- plain/oauth/urls.py,sha256=NyP_yDKayJYrCdw4oNVHUmtjbLNfzdnpdWc-eOsMlDM,676
7
+ plain/oauth/models.py,sha256=wWmxjQaaDAsLoZyNardKr0V27VbGB4L7zAUIFZQRCi4,6866
8
+ plain/oauth/providers.py,sha256=WMLr9g3S84lfIRFslO0VBCmthMBDQ3GCDLSIquTA_Y0,7138
9
+ plain/oauth/urls.py,sha256=OBnn73lu0c9cUMunW9AtkgeSExrksI33MoSuFpBuIlc,733
10
10
  plain/oauth/views.py,sha256=G6icfdKkOOOKB00JVN4SCeZmBcGOGUvAgueyvOd9bLI,3042
11
11
  plain/oauth/migrations/0001_initial.py,sha256=8-JR2McXDUNRhMRUrrZPqzRNpdROfCsIo5Qkndkn-pg,1756
12
12
  plain/oauth/migrations/0002_alter_oauthconnection_options_and_more.py,sha256=3Mb0IU9KDRQfog0PjVbzuNv_AxCs7UVHnA0F263AKNo,581
@@ -15,7 +15,7 @@ plain/oauth/migrations/0004_alter_oauthconnection_access_token_and_more.py,sha25
15
15
  plain/oauth/migrations/0005_alter_oauthconnection_unique_together_and_more.py,sha256=3hmuSvIZhn-haEKOGN3lQzcXD7b_Hy0P8Wa7LOAvJ1k,576
16
16
  plain/oauth/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  plain/oauth/templates/oauth/error.html,sha256=xkkWw57sZ3fz4dDfH30SVtq3okJNnJmrSRPfGxrxjh8,108
18
- plain_oauth-0.8.0.dist-info/METADATA,sha256=Ls2iNx-EEM0bpRkTXC0ZM6swQtHQ-n7tj1D5wZwj5tU,10304
19
- plain_oauth-0.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
- plain_oauth-0.8.0.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
21
- plain_oauth-0.8.0.dist-info/RECORD,,
18
+ plain_oauth-0.9.0.dist-info/METADATA,sha256=uRhh9qZZyhe712Dn_BW1DswApKAjoCjZeoFbhxzFkhQ,10304
19
+ plain_oauth-0.9.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
+ plain_oauth-0.9.0.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
21
+ plain_oauth-0.9.0.dist-info/RECORD,,