plain.oauth 0.25.1__py3-none-any.whl → 0.27.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.
plain/oauth/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # plain-oauth changelog
2
2
 
3
+ ## [0.27.0](https://github.com/dropseed/plain/releases/plain-oauth@0.27.0) (2025-09-25)
4
+
5
+ ### What's changed
6
+
7
+ - The `OAuthConnection.check()` method has been replaced with `OAuthConnection.preflight()` as part of the new preflight system ([b0b610d](https://github.com/dropseed/plain/commit/b0b610d461))
8
+ - Preflight check IDs have been renamed from numeric format (e.g., `plain.oauth.E001`) to descriptive names (e.g., `oauth.provider_in_db_not_in_settings`) ([cd96c97](https://github.com/dropseed/plain/commit/cd96c97b25))
9
+ - Preflight messages now provide clearer fix instructions directly in the `fix` attribute ([c7cde12](https://github.com/dropseed/plain/commit/c7cde12149))
10
+
11
+ ### Upgrade instructions
12
+
13
+ - If you have custom code that calls `OAuthConnection.check()`, update it to use `OAuthConnection.preflight()` instead
14
+ - If you have code that references specific preflight check IDs (e.g., `plain.oauth.E001`), update them to use the new descriptive format (e.g., `oauth.provider_in_db_not_in_settings`)
15
+
16
+ ## [0.26.0](https://github.com/dropseed/plain/releases/plain-oauth@0.26.0) (2025-09-12)
17
+
18
+ ### What's changed
19
+
20
+ - Model queries now use `.query` instead of `.objects` ([037a239](https://github.com/dropseed/plain/commit/037a239ef4))
21
+ - Minimum Python version increased to 3.13 ([d86e307](https://github.com/dropseed/plain/commit/d86e307efb))
22
+
23
+ ### Upgrade instructions
24
+
25
+ - Update any custom code that references `OAuthConnection.objects` to use `OAuthConnection.query` instead
26
+
3
27
  ## [0.25.1](https://github.com/dropseed/plain/releases/plain-oauth@0.25.1) (2025-08-22)
4
28
 
5
29
  ### What's changed
plain/oauth/admin.py CHANGED
@@ -15,7 +15,7 @@ class ProvidersChartCard(ChartCard):
15
15
 
16
16
  def get_chart_data(self) -> dict:
17
17
  results = (
18
- OAuthConnection.objects.all()
18
+ OAuthConnection.query.all()
19
19
  .values("provider_key")
20
20
  .annotate(count=Count("id"))
21
21
  )
plain/oauth/models.py CHANGED
@@ -5,7 +5,7 @@ from plain.auth import get_user_model
5
5
  from plain.exceptions import ValidationError
6
6
  from plain.models import transaction
7
7
  from plain.models.db import IntegrityError, OperationalError, ProgrammingError
8
- from plain.preflight import Error
8
+ from plain.preflight import PreflightResult
9
9
  from plain.runtime import SettingsReference
10
10
  from plain.utils import timezone
11
11
 
@@ -95,7 +95,7 @@ class OAuthConnection(models.Model):
95
95
  cls, *, provider_key: str, oauth_token: "OAuthToken", oauth_user: "OAuthUser"
96
96
  ) -> "OAuthConnection":
97
97
  try:
98
- connection = cls.objects.get(
98
+ connection = cls.query.get(
99
99
  provider_key=provider_key,
100
100
  provider_user_id=oauth_user.provider_id,
101
101
  )
@@ -134,7 +134,7 @@ class OAuthConnection(models.Model):
134
134
  Connect will either create a new connection or update an existing connection
135
135
  """
136
136
  try:
137
- connection = cls.objects.get(
137
+ connection = cls.query.get(
138
138
  user=user,
139
139
  provider_key=provider_key,
140
140
  provider_user_id=oauth_user.provider_id,
@@ -155,24 +155,17 @@ class OAuthConnection(models.Model):
155
155
  return connection
156
156
 
157
157
  @classmethod
158
- def check(cls, **kwargs):
158
+ def preflight(cls):
159
159
  """
160
160
  A system check for ensuring that provider_keys in the database are also present in settings.
161
-
162
- Note that the --database flag is required for this to work:
163
- plain check --database default
164
161
  """
165
- errors = super().check(**kwargs)
166
-
167
- database = kwargs.get("database", False)
168
- if not database:
169
- return errors
162
+ errors = super().preflight()
170
163
 
171
164
  from .providers import get_provider_keys
172
165
 
173
166
  try:
174
167
  keys_in_db = set(
175
- cls.objects.values_list("provider_key", flat=True).distinct()
168
+ cls.query.values_list("provider_key", flat=True).distinct()
176
169
  )
177
170
  except (OperationalError, ProgrammingError):
178
171
  # Check runs on plain migrate, and the table may not exist yet
@@ -183,11 +176,11 @@ class OAuthConnection(models.Model):
183
176
 
184
177
  if keys_in_db - keys_in_settings:
185
178
  errors.append(
186
- Error(
187
- "The following OAuth providers are in the database but not in the settings: {}".format(
179
+ PreflightResult(
180
+ fix="The following OAuth providers are in the database but not in the settings: {}. Add these providers to your OAUTH_LOGIN_PROVIDERS setting or remove the corresponding OAuthConnection records.".format(
188
181
  ", ".join(keys_in_db - keys_in_settings)
189
182
  ),
190
- id="plain.oauth.E001",
183
+ id="oauth.provider_in_db_not_in_settings",
191
184
  )
192
185
  )
193
186
 
plain/oauth/providers.py CHANGED
@@ -144,7 +144,7 @@ class OAuthProvider:
144
144
 
145
145
  def handle_disconnect_request(self, *, request: HttpRequest) -> Response:
146
146
  provider_user_id = request.data["provider_user_id"]
147
- connection = OAuthConnection.objects.get(
147
+ connection = OAuthConnection.query.get(
148
148
  provider_key=self.provider_key, provider_user_id=provider_user_id
149
149
  )
150
150
  connection.delete()
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.oauth
3
- Version: 0.25.1
3
+ Version: 0.27.0
4
4
  Summary: Let users log in with OAuth providers.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
7
7
  License-File: LICENSE
8
- Requires-Python: >=3.11
8
+ Requires-Python: >=3.13
9
9
  Requires-Dist: plain-auth<1.0.0
10
10
  Requires-Dist: plain-models<1.0.0
11
11
  Requires-Dist: plain<1.0.0
@@ -1,18 +1,18 @@
1
- plain/oauth/CHANGELOG.md,sha256=6Qzh3TXra_ykDhgWyZKmRZh9WztYvhNnzm6w8HUJ6QM,2777
1
+ plain/oauth/CHANGELOG.md,sha256=ciArPMh1SpNbV8WuF1fGJhBCMDAoH6hz4k2I1XELWx4,4257
2
2
  plain/oauth/README.md,sha256=m3RRb01DLnoxBtzuYzESSe49OmsZ8P1R5_QsfCSRQgo,11077
3
3
  plain/oauth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- plain/oauth/admin.py,sha256=G1DFqGr5AEMbgVG689uGPC0YBD6gLifoz67yUOmslvs,1310
4
+ plain/oauth/admin.py,sha256=s259OnTWGeOv3nVl4hAV-lNAIE4d2ObbG_97ENC6TuY,1308
5
5
  plain/oauth/config.py,sha256=0Q4IILBKQbIaxqeL9WRTH5Cka-BO3c3SOj1AdQIAJgc,167
6
6
  plain/oauth/default_settings.py,sha256=dlN1J9vSOjjxPNLp-0qe-cLTqwM4E69ZAx_8lpxMhaM,28
7
7
  plain/oauth/exceptions.py,sha256=yoZsq8XgzstuwbE2ihoet0nzpw_sVZgDrwUauh6hhUs,546
8
- plain/oauth/models.py,sha256=iCh_cyi2ajBN2IO8xBIHLyAyjk4OMgB4ziwDQymvwJo,6739
9
- plain/oauth/providers.py,sha256=YDftJUMyyfXgsDCkyTNxGwrbwXAowL0Hg6KrwrAN5S0,7793
8
+ plain/oauth/models.py,sha256=BKeJrfm93E1W5Zzf7z41hk0WvJe6p-EjZcZavmkGkRs,6668
9
+ plain/oauth/providers.py,sha256=hk4e-7WKZcou0-OWPV1x07JB4duef9hRFGeA9fANCoU,7791
10
10
  plain/oauth/urls.py,sha256=FYzpQwhvZdcat8n3f7RyA-1Q21finKb8JEyakSOjXXg,696
11
11
  plain/oauth/views.py,sha256=J2NCa37YediBTi82CfRlmsb45hFT6gWN6zMaFHhsDMM,2410
12
12
  plain/oauth/migrations/0001_initial.py,sha256=0NjfF7F3szhUXkpK3JvN10Xkat1QR-VvnX6Oed9iFmo,1940
13
13
  plain/oauth/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  plain/oauth/templates/oauth/callback.html,sha256=4CJG0oAN0xYjw2IPkjaL7B4hwlf9um9LI4CTu50E-yE,173
15
- plain_oauth-0.25.1.dist-info/METADATA,sha256=CRarRZlMr082RD80RN_yQv-kSo8-jNO_XTARBUtr-eE,11482
16
- plain_oauth-0.25.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
- plain_oauth-0.25.1.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
18
- plain_oauth-0.25.1.dist-info/RECORD,,
15
+ plain_oauth-0.27.0.dist-info/METADATA,sha256=QTNqWG8CB-gg3S-QB-qMm_AXR3_Z5lFLnily--pajXk,11482
16
+ plain_oauth-0.27.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
+ plain_oauth-0.27.0.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
18
+ plain_oauth-0.27.0.dist-info/RECORD,,