plain.oauth 0.21.0__py3-none-any.whl → 0.23.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.
@@ -0,0 +1,21 @@
1
+ # plain-oauth changelog
2
+
3
+ ## [0.23.0](https://github.com/dropseed/plain/releases/plain-oauth@0.23.0) (2025-07-18)
4
+
5
+ ### What's changed
6
+
7
+ - Migrations have been restarted to consolidate the migration history into a single initial migration ([484f1b6](https://github.com/dropseed/plain/commit/484f1b6e93))
8
+
9
+ ### Upgrade instructions
10
+
11
+ - Run `plain migrate --prune plainoauth` after upgrading to clean up old migration records
12
+
13
+ ## [0.22.0](https://github.com/dropseed/plain/releases/plain-oauth@0.22.0) (2025-06-23)
14
+
15
+ ### What's changed
16
+
17
+ - Updated `OAuthConnection.check()` to accept a single `database` argument instead of the older `databases` list, matching the new single `DATABASE` setting used across the Plain stack ([d346d81](https://github.com/dropseed/plain/commit/d346d81))
18
+
19
+ ### Upgrade instructions
20
+
21
+ - No changes required.
@@ -1,4 +1,4 @@
1
- # Generated by Plain 4.0.3 on 2022-03-16 19:11
1
+ # Generated by Plain 0.52.2 on 2025-07-08 01:17
2
2
 
3
3
  import plain.models.deletion
4
4
  from plain import models
@@ -17,35 +17,39 @@ class Migration(migrations.Migration):
17
17
  migrations.CreateModel(
18
18
  name="OAuthConnection",
19
19
  fields=[
20
- (
21
- "id",
22
- models.BigAutoField(
23
- auto_created=True,
24
- primary_key=True,
25
- ),
26
- ),
20
+ ("id", models.BigAutoField(auto_created=True, primary_key=True)),
27
21
  ("created_at", models.DateTimeField(auto_now_add=True)),
28
22
  ("updated_at", models.DateTimeField(auto_now=True)),
29
23
  ("provider_key", models.CharField(max_length=100)),
30
24
  ("provider_user_id", models.CharField(max_length=100)),
31
- ("access_token", models.CharField(required=False, max_length=100)),
32
- ("refresh_token", models.CharField(required=False, max_length=100)),
25
+ ("access_token", models.CharField(max_length=2000)),
26
+ ("refresh_token", models.CharField(max_length=2000, required=False)),
33
27
  (
34
28
  "access_token_expires_at",
35
- models.DateTimeField(required=False, allow_null=True),
29
+ models.DateTimeField(allow_null=True, required=False),
36
30
  ),
37
31
  (
38
32
  "refresh_token_expires_at",
39
- models.DateTimeField(required=False, allow_null=True),
33
+ models.DateTimeField(allow_null=True, required=False),
40
34
  ),
41
35
  (
42
36
  "user",
43
37
  models.ForeignKey(
44
38
  on_delete=plain.models.deletion.CASCADE,
45
39
  related_name="oauth_connections",
46
- to=settings.AUTH_USER_MODEL,
40
+ to="users.user",
47
41
  ),
48
42
  ),
49
43
  ],
44
+ options={
45
+ "ordering": ("provider_key",),
46
+ },
47
+ ),
48
+ migrations.AddConstraint(
49
+ model_name="oauthconnection",
50
+ constraint=models.UniqueConstraint(
51
+ fields=("provider_key", "provider_user_id"),
52
+ name="plainoauth_oauthconnection_unique_provider_key_user_id",
53
+ ),
50
54
  ),
51
55
  ]
plain/oauth/models.py CHANGED
@@ -164,34 +164,31 @@ class OAuthConnection(models.Model):
164
164
  """
165
165
  errors = super().check(**kwargs)
166
166
 
167
- databases = kwargs.get("databases", None)
168
- if not databases:
167
+ database = kwargs.get("database", False)
168
+ if not database:
169
169
  return errors
170
170
 
171
171
  from .providers import get_provider_keys
172
172
 
173
- for database in databases:
174
- try:
175
- keys_in_db = set(
176
- cls.objects.using(database)
177
- .values_list("provider_key", flat=True)
178
- .distinct()
179
- )
180
- except (OperationalError, ProgrammingError):
181
- # Check runs on manage.py migrate, and the table may not exist yet
182
- # or it may not be installed on the particular database intentionally
183
- continue
184
-
185
- keys_in_settings = set(get_provider_keys())
186
-
187
- if keys_in_db - keys_in_settings:
188
- errors.append(
189
- Error(
190
- "The following OAuth providers are in the database but not in the settings: {}".format(
191
- ", ".join(keys_in_db - keys_in_settings)
192
- ),
193
- id="plain.oauth.E001",
194
- )
173
+ try:
174
+ keys_in_db = set(
175
+ cls.objects.values_list("provider_key", flat=True).distinct()
176
+ )
177
+ except (OperationalError, ProgrammingError):
178
+ # Check runs on manage.py migrate, and the table may not exist yet
179
+ # or it may not be installed on the particular database intentionally
180
+ return errors
181
+
182
+ keys_in_settings = set(get_provider_keys())
183
+
184
+ if keys_in_db - keys_in_settings:
185
+ errors.append(
186
+ Error(
187
+ "The following OAuth providers are in the database but not in the settings: {}".format(
188
+ ", ".join(keys_in_db - keys_in_settings)
189
+ ),
190
+ id="plain.oauth.E001",
195
191
  )
192
+ )
196
193
 
197
194
  return errors
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.oauth
3
- Version: 0.21.0
3
+ Version: 0.23.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
@@ -0,0 +1,18 @@
1
+ plain/oauth/CHANGELOG.md,sha256=hpiqoYje6dg5Y5h0BcjKl781Q_o0-U3vPCGRgvBd0KQ,826
2
+ plain/oauth/README.md,sha256=N8getAUUhLX6P4mg-5P0V41gk5EKBGb8v904OfP2Z9E,9961
3
+ plain/oauth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ plain/oauth/admin.py,sha256=rqrGRRUVxOlG9wiuXtndIyQxd1VT67cvFy6qWo7LF-Q,1278
5
+ plain/oauth/config.py,sha256=0Q4IILBKQbIaxqeL9WRTH5Cka-BO3c3SOj1AdQIAJgc,167
6
+ plain/oauth/default_settings.py,sha256=dlN1J9vSOjjxPNLp-0qe-cLTqwM4E69ZAx_8lpxMhaM,28
7
+ plain/oauth/exceptions.py,sha256=yoZsq8XgzstuwbE2ihoet0nzpw_sVZgDrwUauh6hhUs,546
8
+ plain/oauth/models.py,sha256=T8VqqxeYGC4xKRVzUKAnc0OU3GN0otDAShDS6CPJhJs,6754
9
+ plain/oauth/providers.py,sha256=YDftJUMyyfXgsDCkyTNxGwrbwXAowL0Hg6KrwrAN5S0,7793
10
+ plain/oauth/urls.py,sha256=FYzpQwhvZdcat8n3f7RyA-1Q21finKb8JEyakSOjXXg,696
11
+ plain/oauth/views.py,sha256=J2NCa37YediBTi82CfRlmsb45hFT6gWN6zMaFHhsDMM,2410
12
+ plain/oauth/migrations/0001_initial.py,sha256=Vck4r6fzVasC8tveOl6Iufwy01SskcxkI2WkCO3DXCA,1972
13
+ plain/oauth/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ plain/oauth/templates/oauth/callback.html,sha256=4CJG0oAN0xYjw2IPkjaL7B4hwlf9um9LI4CTu50E-yE,173
15
+ plain_oauth-0.23.0.dist-info/METADATA,sha256=8SCsBLL8C2R3P7Lp8bwbigV0MhP5XuKXb9ymhPqF0cE,10365
16
+ plain_oauth-0.23.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
+ plain_oauth-0.23.0.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
18
+ plain_oauth-0.23.0.dist-info/RECORD,,
@@ -1,24 +0,0 @@
1
- # Generated by Plain 4.0.3 on 2022-03-18 18:24
2
-
3
- from plain import models
4
- from plain.models import migrations
5
-
6
-
7
- class Migration(migrations.Migration):
8
- dependencies = [
9
- ("plainoauth", "0001_initial"),
10
- ]
11
-
12
- operations = [
13
- migrations.AlterModelOptions(
14
- name="oauthconnection",
15
- options={
16
- "ordering": ("provider_key",),
17
- },
18
- ),
19
- migrations.AlterField(
20
- model_name="oauthconnection",
21
- name="access_token",
22
- field=models.CharField(max_length=100),
23
- ),
24
- ]
@@ -1,23 +0,0 @@
1
- # Generated by Plain 4.0.6 on 2022-08-11 19:18
2
-
3
- from plain import models
4
- from plain.models import migrations
5
-
6
-
7
- class Migration(migrations.Migration):
8
- dependencies = [
9
- ("plainoauth", "0002_alter_oauthconnection_options_and_more"),
10
- ]
11
-
12
- operations = [
13
- migrations.AlterField(
14
- model_name="oauthconnection",
15
- name="access_token",
16
- field=models.CharField(max_length=300),
17
- ),
18
- migrations.AlterField(
19
- model_name="oauthconnection",
20
- name="refresh_token",
21
- field=models.CharField(required=False, max_length=300),
22
- ),
23
- ]
@@ -1,23 +0,0 @@
1
- # Generated by Plain 5.0.dev20230806030948 on 2023-08-08 19:32
2
-
3
- from plain import models
4
- from plain.models import migrations
5
-
6
-
7
- class Migration(migrations.Migration):
8
- dependencies = [
9
- ("plainoauth", "0003_alter_oauthconnection_access_token_and_more"),
10
- ]
11
-
12
- operations = [
13
- migrations.AlterField(
14
- model_name="oauthconnection",
15
- name="access_token",
16
- field=models.CharField(max_length=2000),
17
- ),
18
- migrations.AlterField(
19
- model_name="oauthconnection",
20
- name="refresh_token",
21
- field=models.CharField(required=False, max_length=2000),
22
- ),
23
- ]
@@ -1,20 +0,0 @@
1
- # Generated by Plain 0.3.0 on 2024-08-16 16:46
2
-
3
- from plain import models
4
- from plain.models import migrations
5
-
6
-
7
- class Migration(migrations.Migration):
8
- dependencies = [
9
- ("plainoauth", "0004_alter_oauthconnection_access_token_and_more"),
10
- ]
11
-
12
- operations = [
13
- migrations.AddConstraint(
14
- model_name="oauthconnection",
15
- constraint=models.UniqueConstraint(
16
- fields=("provider_key", "provider_user_id"),
17
- name="unique_oauth_provider_user_id",
18
- ),
19
- ),
20
- ]
@@ -1,24 +0,0 @@
1
- # Generated by Plain 0.31.0 on 2025-03-08 21:33
2
-
3
- from plain import models
4
- from plain.models import migrations
5
-
6
-
7
- class Migration(migrations.Migration):
8
- dependencies = [
9
- ("plainoauth", "0005_alter_oauthconnection_unique_together_and_more"),
10
- ]
11
-
12
- operations = [
13
- migrations.RemoveConstraint(
14
- model_name="oauthconnection",
15
- name="unique_oauth_provider_user_id",
16
- ),
17
- migrations.AddConstraint(
18
- model_name="oauthconnection",
19
- constraint=models.UniqueConstraint(
20
- fields=("provider_key", "provider_user_id"),
21
- name="plainoauth_oauthconnection_unique_provider_key_user_id",
22
- ),
23
- ),
24
- ]
@@ -1,26 +0,0 @@
1
- # Generated by Plain 0.32.0 on 2025-03-10 15:37
2
-
3
- from plain import models
4
- from plain.models import migrations
5
-
6
-
7
- class Migration(migrations.Migration):
8
- dependencies = [
9
- (
10
- "plainoauth",
11
- "0006_remove_oauthconnection_unique_oauth_provider_user_id_and_more",
12
- ),
13
- ]
14
-
15
- operations = [
16
- migrations.AlterField(
17
- model_name="oauthconnection",
18
- name="provider_key",
19
- field=models.CharField(max_length=100),
20
- ),
21
- migrations.AlterField(
22
- model_name="oauthconnection",
23
- name="provider_user_id",
24
- field=models.CharField(max_length=100),
25
- ),
26
- ]
@@ -1,23 +0,0 @@
1
- plain/oauth/README.md,sha256=N8getAUUhLX6P4mg-5P0V41gk5EKBGb8v904OfP2Z9E,9961
2
- plain/oauth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- plain/oauth/admin.py,sha256=rqrGRRUVxOlG9wiuXtndIyQxd1VT67cvFy6qWo7LF-Q,1278
4
- plain/oauth/config.py,sha256=0Q4IILBKQbIaxqeL9WRTH5Cka-BO3c3SOj1AdQIAJgc,167
5
- plain/oauth/default_settings.py,sha256=dlN1J9vSOjjxPNLp-0qe-cLTqwM4E69ZAx_8lpxMhaM,28
6
- plain/oauth/exceptions.py,sha256=yoZsq8XgzstuwbE2ihoet0nzpw_sVZgDrwUauh6hhUs,546
7
- plain/oauth/models.py,sha256=_DS8Mv-dn_a9EO63aNb8oV8jxXUgHkoytrMkBritVhQ,6916
8
- plain/oauth/providers.py,sha256=YDftJUMyyfXgsDCkyTNxGwrbwXAowL0Hg6KrwrAN5S0,7793
9
- plain/oauth/urls.py,sha256=FYzpQwhvZdcat8n3f7RyA-1Q21finKb8JEyakSOjXXg,696
10
- plain/oauth/views.py,sha256=J2NCa37YediBTi82CfRlmsb45hFT6gWN6zMaFHhsDMM,2410
11
- plain/oauth/migrations/0001_initial.py,sha256=B9Finbn7ijEIUbkDy_B7UsKQLfMWaXd0Kx3oZrUENWc,1753
12
- plain/oauth/migrations/0002_alter_oauthconnection_options_and_more.py,sha256=3Mb0IU9KDRQfog0PjVbzuNv_AxCs7UVHnA0F263AKNo,581
13
- plain/oauth/migrations/0003_alter_oauthconnection_access_token_and_more.py,sha256=FyLfwxc2pRzF-CbdRFQRRSQTOCxc9l1womgStygm_lo,629
14
- plain/oauth/migrations/0004_alter_oauthconnection_access_token_and_more.py,sha256=ho9CG-lf7OVg1vBnjn7miihoioNmOIz7ObxB2QkPeSo,652
15
- plain/oauth/migrations/0005_alter_oauthconnection_unique_together_and_more.py,sha256=MdTjX5Awff0QPesdAT5JuToitnbphgIh-nsJnZEAAa0,544
16
- plain/oauth/migrations/0006_remove_oauthconnection_unique_oauth_provider_user_id_and_more.py,sha256=UjWRezZoAzjVS70oCRQ38k_w6YJtcd_uSYT4Kc3H1pg,713
17
- plain/oauth/migrations/0007_alter_oauthconnection_provider_key_and_more.py,sha256=B_LW6xG1o_uA13tqUs0KniXl1JBNbQu4wMh2pW8rq5I,675
18
- plain/oauth/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- plain/oauth/templates/oauth/callback.html,sha256=4CJG0oAN0xYjw2IPkjaL7B4hwlf9um9LI4CTu50E-yE,173
20
- plain_oauth-0.21.0.dist-info/METADATA,sha256=mdMZjbi7Tp69z0XeUxO2jDUEdLQpZcWqT7dseHafO0Y,10365
21
- plain_oauth-0.21.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
- plain_oauth-0.21.0.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
23
- plain_oauth-0.21.0.dist-info/RECORD,,