plain.auth 0.20.7__tar.gz → 0.22.0__tar.gz

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.
Files changed (22) hide show
  1. {plain_auth-0.20.7 → plain_auth-0.22.0}/.gitignore +4 -2
  2. {plain_auth-0.20.7 → plain_auth-0.22.0}/PKG-INFO +1 -1
  3. {plain_auth-0.20.7 → plain_auth-0.22.0}/plain/auth/CHANGELOG.md +20 -0
  4. {plain_auth-0.20.7 → plain_auth-0.22.0}/plain/auth/views.py +5 -10
  5. {plain_auth-0.20.7 → plain_auth-0.22.0}/pyproject.toml +1 -1
  6. {plain_auth-0.20.7 → plain_auth-0.22.0}/tests/app/urls.py +5 -5
  7. plain_auth-0.22.0/tests/app/users/models.py +8 -0
  8. plain_auth-0.20.7/tests/app/users/models.py +0 -7
  9. {plain_auth-0.20.7 → plain_auth-0.22.0}/LICENSE +0 -0
  10. {plain_auth-0.20.7 → plain_auth-0.22.0}/README.md +0 -0
  11. {plain_auth-0.20.7 → plain_auth-0.22.0}/plain/auth/README.md +0 -0
  12. {plain_auth-0.20.7 → plain_auth-0.22.0}/plain/auth/__init__.py +0 -0
  13. {plain_auth-0.20.7 → plain_auth-0.22.0}/plain/auth/default_settings.py +0 -0
  14. {plain_auth-0.20.7 → plain_auth-0.22.0}/plain/auth/requests.py +0 -0
  15. {plain_auth-0.20.7 → plain_auth-0.22.0}/plain/auth/sessions.py +0 -0
  16. {plain_auth-0.20.7 → plain_auth-0.22.0}/plain/auth/templates.py +0 -0
  17. {plain_auth-0.20.7 → plain_auth-0.22.0}/plain/auth/test.py +0 -0
  18. {plain_auth-0.20.7 → plain_auth-0.22.0}/plain/auth/utils.py +0 -0
  19. {plain_auth-0.20.7 → plain_auth-0.22.0}/tests/app/settings.py +0 -0
  20. {plain_auth-0.20.7 → plain_auth-0.22.0}/tests/app/users/migrations/0001_initial.py +0 -0
  21. {plain_auth-0.20.7 → plain_auth-0.22.0}/tests/app/users/migrations/__init__.py +0 -0
  22. {plain_auth-0.20.7 → plain_auth-0.22.0}/tests/test_views.py +0 -0
@@ -5,11 +5,13 @@
5
5
  __pycache__
6
6
  *.DS_Store
7
7
 
8
+ /*.code-workspace
9
+
8
10
  # Test apps
9
11
  plain*/tests/.plain
10
12
 
11
- # Ottobot
12
- .aider*
13
+ # Agent scratch files
14
+ /scratch
13
15
 
14
16
  # Plain temp dirs
15
17
  .plain
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.auth
3
- Version: 0.20.7
3
+ Version: 0.22.0
4
4
  Summary: Add users to your app and decide what they can access.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -1,5 +1,25 @@
1
1
  # plain-auth changelog
2
2
 
3
+ ## [0.22.0](https://github.com/dropseed/plain/releases/plain-auth@0.22.0) (2025-11-24)
4
+
5
+ ### What's changed
6
+
7
+ - Replaced `AuthViewMixin` with `AuthView` class that inherits from `SessionView` for better typing and simpler view inheritance ([569afd6](https://github.com/dropseed/plain/commit/569afd606d))
8
+
9
+ ### Upgrade instructions
10
+
11
+ - Replace `class MyView(AuthViewMixin, View)` with `class MyView(AuthView)` - the new `AuthView` class already inherits from the appropriate base classes
12
+
13
+ ## [0.21.0](https://github.com/dropseed/plain/releases/plain-auth@0.21.0) (2025-11-12)
14
+
15
+ ### What's changed
16
+
17
+ - Improved type checking compatibility by adding type ignore comment for mixin method resolution in `AuthViewMixin` ([f4dbcef](https://github.com/dropseed/plain/commit/f4dbcefa92))
18
+
19
+ ### Upgrade instructions
20
+
21
+ - No changes required
22
+
3
23
  ## [0.20.7](https://github.com/dropseed/plain/releases/plain-auth@0.20.7) (2025-10-31)
4
24
 
5
25
  ### What's changed
@@ -1,18 +1,18 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from functools import cached_property
4
- from typing import TYPE_CHECKING, Any
4
+ from typing import Any
5
5
  from urllib.parse import urlparse, urlunparse
6
6
 
7
7
  from plain.exceptions import PermissionDenied
8
8
  from plain.http import (
9
9
  Http404,
10
10
  QueryDict,
11
- Response,
11
+ ResponseBase,
12
12
  ResponseRedirect,
13
13
  )
14
14
  from plain.runtime import settings
15
- from plain.sessions.views import SessionViewMixin
15
+ from plain.sessions.views import SessionView
16
16
  from plain.urls import reverse
17
17
  from plain.utils.cache import patch_cache_control
18
18
  from plain.views import View
@@ -20,9 +20,6 @@ from plain.views import View
20
20
  from .sessions import logout
21
21
  from .utils import resolve_url
22
22
 
23
- if TYPE_CHECKING:
24
- from plain.http import Request
25
-
26
23
  try:
27
24
  from plain.admin.impersonate import get_request_impersonator
28
25
  except ImportError:
@@ -35,13 +32,11 @@ class LoginRequired(Exception):
35
32
  self.redirect_field_name = redirect_field_name
36
33
 
37
34
 
38
- class AuthViewMixin(SessionViewMixin):
35
+ class AuthView(SessionView):
39
36
  login_required = False
40
37
  admin_required = False # Implies login_required
41
38
  login_url = settings.AUTH_LOGIN_URL
42
39
 
43
- request: Request
44
-
45
40
  @cached_property
46
41
  def user(self) -> Any | None:
47
42
  """Get the authenticated user for this request."""
@@ -84,7 +79,7 @@ class AuthViewMixin(SessionViewMixin):
84
79
  # Show a 404 so we don't expose admin urls to non-admin users
85
80
  raise Http404()
86
81
 
87
- def get_response(self) -> Response:
82
+ def get_response(self) -> ResponseBase:
88
83
  try:
89
84
  self.check_auth()
90
85
  except LoginRequired as e:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "plain.auth"
3
- version = "0.20.7"
3
+ version = "0.22.0"
4
4
  description = "Add users to your app and decide what they can access."
5
5
  authors = [{name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev"}]
6
6
  readme = "README.md"
@@ -1,4 +1,4 @@
1
- from plain.auth.views import AuthViewMixin
1
+ from plain.auth.views import AuthView
2
2
  from plain.urls import Router, path
3
3
  from plain.views import View
4
4
 
@@ -8,28 +8,28 @@ class LoginView(View):
8
8
  return "login"
9
9
 
10
10
 
11
- class ProtectedView(AuthViewMixin, View):
11
+ class ProtectedView(AuthView):
12
12
  login_required = True
13
13
 
14
14
  def get(self):
15
15
  return "protected"
16
16
 
17
17
 
18
- class OpenView(AuthViewMixin, View):
18
+ class OpenView(AuthView):
19
19
  # login_required = False
20
20
 
21
21
  def get(self):
22
22
  return "open"
23
23
 
24
24
 
25
- class AdminView(AuthViewMixin, View):
25
+ class AdminView(AuthView):
26
26
  admin_required = True
27
27
 
28
28
  def get(self):
29
29
  return "admin"
30
30
 
31
31
 
32
- class NoLoginUrlView(AuthViewMixin, View):
32
+ class NoLoginUrlView(AuthView):
33
33
  login_required = True
34
34
  login_url = None
35
35
 
@@ -0,0 +1,8 @@
1
+ from plain import models
2
+ from plain.models import types
3
+
4
+
5
+ @models.register_model
6
+ class User(models.Model):
7
+ username: str = types.CharField(max_length=255)
8
+ is_admin: bool = types.BooleanField(default=False)
@@ -1,7 +0,0 @@
1
- from plain import models
2
-
3
-
4
- @models.register_model
5
- class User(models.Model):
6
- username = models.CharField(max_length=255)
7
- is_admin = models.BooleanField(default=False)
File without changes
File without changes