plain.auth 0.22.0__tar.gz → 0.24.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.auth
3
- Version: 0.22.0
3
+ Version: 0.24.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
@@ -152,7 +152,7 @@ Use the [`AuthViewMixin`](./views.py#AuthViewMixin) to restrict views to logged-
152
152
 
153
153
  ```python
154
154
  from plain.auth.views import AuthViewMixin
155
- from plain.exceptions import PermissionDenied
155
+ from plain.http import ForbiddenError403
156
156
  from plain.views import View
157
157
 
158
158
 
@@ -169,7 +169,7 @@ class CustomPermissionView(AuthViewMixin, View):
169
169
  def check_auth(self):
170
170
  super().check_auth()
171
171
  if not self.user.is_special:
172
- raise PermissionDenied("You're not special!")
172
+ raise ForbiddenError403("You're not special!")
173
173
  ```
174
174
 
175
175
  The [`AuthViewMixin`](./views.py#AuthViewMixin) provides:
@@ -1,5 +1,28 @@
1
1
  # plain-auth changelog
2
2
 
3
+ ## [0.24.0](https://github.com/dropseed/plain/releases/plain-auth@0.24.0) (2026-01-13)
4
+
5
+ ### What's changed
6
+
7
+ - HTTP exceptions moved from `plain.exceptions` to `plain.http.exceptions` (exported via `plain.http`) ([b61f909](https://github.com/dropseed/plain/commit/b61f909e29))
8
+
9
+ ### Upgrade instructions
10
+
11
+ - Update imports of HTTP exceptions from `plain.exceptions` to `plain.http` (e.g., `from plain.exceptions import ForbiddenError403` becomes `from plain.http import ForbiddenError403`)
12
+
13
+ ## [0.23.0](https://github.com/dropseed/plain/releases/plain-auth@0.23.0) (2026-01-13)
14
+
15
+ ### What's changed
16
+
17
+ - HTTP exception classes renamed to include `Error` suffix and status code: `PermissionDenied` → `ForbiddenError403`, `Http404` → `NotFoundError404` ([5a1f020](https://github.com/dropseed/plain/commit/5a1f020f52))
18
+ - Response classes renamed: `ResponseRedirect` → `RedirectResponse` ([fad5bf2](https://github.com/dropseed/plain/commit/fad5bf28b0))
19
+
20
+ ### Upgrade instructions
21
+
22
+ - Replace `PermissionDenied` with `ForbiddenError403` in any custom auth logic (e.g., `raise PermissionDenied("message")` becomes `raise ForbiddenError403("message")`)
23
+ - Replace `Http404` with `NotFoundError404` if used in auth-related code
24
+ - Replace `ResponseRedirect` with `RedirectResponse` if imported from `plain.http`
25
+
3
26
  ## [0.22.0](https://github.com/dropseed/plain/releases/plain-auth@0.22.0) (2025-11-24)
4
27
 
5
28
  ### What's changed
@@ -139,7 +139,7 @@ Use the [`AuthViewMixin`](./views.py#AuthViewMixin) to restrict views to logged-
139
139
 
140
140
  ```python
141
141
  from plain.auth.views import AuthViewMixin
142
- from plain.exceptions import PermissionDenied
142
+ from plain.http import ForbiddenError403
143
143
  from plain.views import View
144
144
 
145
145
 
@@ -156,7 +156,7 @@ class CustomPermissionView(AuthViewMixin, View):
156
156
  def check_auth(self):
157
157
  super().check_auth()
158
158
  if not self.user.is_special:
159
- raise PermissionDenied("You're not special!")
159
+ raise ForbiddenError403("You're not special!")
160
160
  ```
161
161
 
162
162
  The [`AuthViewMixin`](./views.py#AuthViewMixin) provides:
@@ -4,12 +4,12 @@ from functools import cached_property
4
4
  from typing import Any
5
5
  from urllib.parse import urlparse, urlunparse
6
6
 
7
- from plain.exceptions import PermissionDenied
8
7
  from plain.http import (
9
- Http404,
8
+ ForbiddenError403,
9
+ NotFoundError404,
10
10
  QueryDict,
11
+ RedirectResponse,
11
12
  ResponseBase,
12
- ResponseRedirect,
13
13
  )
14
14
  from plain.runtime import settings
15
15
  from plain.sessions.views import SessionView
@@ -52,9 +52,9 @@ class AuthView(SessionView):
52
52
 
53
53
  def check_auth(self) -> None:
54
54
  """
55
- Raises either LoginRequired or PermissionDenied.
55
+ Raises either LoginRequired or ForbiddenError403.
56
56
  - LoginRequired can specify a login_url and redirect_field_name
57
- - PermissionDenied can specify a message
57
+ - ForbiddenError403 can specify a message
58
58
  """
59
59
  if not self.login_required and not self.admin_required:
60
60
  return None
@@ -70,14 +70,14 @@ class AuthView(SessionView):
70
70
  # Impersonators should be able to view admin pages while impersonating.
71
71
  # There's probably never a case where an impersonator isn't admin, but it can be configured.
72
72
  if not impersonator.is_admin:
73
- raise PermissionDenied(
73
+ raise ForbiddenError403(
74
74
  "You do not have permission to access this page."
75
75
  )
76
76
  return
77
77
 
78
78
  if not self.user.is_admin:
79
79
  # Show a 404 so we don't expose admin urls to non-admin users
80
- raise Http404()
80
+ raise NotFoundError404()
81
81
 
82
82
  def get_response(self) -> ResponseBase:
83
83
  try:
@@ -103,7 +103,7 @@ class AuthView(SessionView):
103
103
  e.redirect_field_name,
104
104
  )
105
105
  else:
106
- raise PermissionDenied("Login required")
106
+ raise ForbiddenError403("Login required")
107
107
 
108
108
  response = super().get_response()
109
109
 
@@ -115,14 +115,14 @@ class AuthView(SessionView):
115
115
 
116
116
 
117
117
  class LogoutView(View):
118
- def post(self) -> ResponseRedirect:
118
+ def post(self) -> RedirectResponse:
119
119
  logout(self.request)
120
- return ResponseRedirect("/")
120
+ return RedirectResponse("/")
121
121
 
122
122
 
123
123
  def redirect_to_login(
124
124
  next: str, login_url: str | None = None, redirect_field_name: str = "next"
125
- ) -> ResponseRedirect:
125
+ ) -> RedirectResponse:
126
126
  """
127
127
  Redirect the user to the login page, passing the given 'next' page.
128
128
  """
@@ -134,4 +134,4 @@ def redirect_to_login(
134
134
  querystring[redirect_field_name] = next
135
135
  login_url_parts[4] = querystring.urlencode(safe="/")
136
136
 
137
- return ResponseRedirect(str(urlunparse(login_url_parts)))
137
+ return RedirectResponse(str(urlunparse(login_url_parts)))
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "plain.auth"
3
- version = "0.22.0"
3
+ version = "0.24.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"
File without changes
File without changes
File without changes