plain.auth 0.20.5__tar.gz → 0.20.7__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.
- {plain_auth-0.20.5 → plain_auth-0.20.7}/.gitignore +1 -1
- {plain_auth-0.20.5 → plain_auth-0.20.7}/PKG-INFO +2 -1
- {plain_auth-0.20.5 → plain_auth-0.20.7}/plain/auth/CHANGELOG.md +20 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/plain/auth/views.py +16 -8
- {plain_auth-0.20.5 → plain_auth-0.20.7}/pyproject.toml +2 -1
- {plain_auth-0.20.5 → plain_auth-0.20.7}/LICENSE +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/README.md +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/plain/auth/README.md +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/plain/auth/__init__.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/plain/auth/default_settings.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/plain/auth/requests.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/plain/auth/sessions.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/plain/auth/templates.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/plain/auth/test.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/plain/auth/utils.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/tests/app/settings.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/tests/app/urls.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/tests/app/users/migrations/0001_initial.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/tests/app/users/migrations/__init__.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/tests/app/users/models.py +0 -0
- {plain_auth-0.20.5 → plain_auth-0.20.7}/tests/test_views.py +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plain.auth
|
|
3
|
-
Version: 0.20.
|
|
3
|
+
Version: 0.20.7
|
|
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
|
+
License-Expression: BSD-3-Clause
|
|
6
7
|
License-File: LICENSE
|
|
7
8
|
Requires-Python: >=3.13
|
|
8
9
|
Requires-Dist: plain-models<1.0.0
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# plain-auth changelog
|
|
2
2
|
|
|
3
|
+
## [0.20.7](https://github.com/dropseed/plain/releases/plain-auth@0.20.7) (2025-10-31)
|
|
4
|
+
|
|
5
|
+
### What's changed
|
|
6
|
+
|
|
7
|
+
- Added `license = "BSD-3-Clause"` field to `pyproject.toml` for improved package metadata ([8477355](https://github.com/dropseed/plain/commit/8477355e65))
|
|
8
|
+
|
|
9
|
+
### Upgrade instructions
|
|
10
|
+
|
|
11
|
+
- No changes required
|
|
12
|
+
|
|
13
|
+
## [0.20.6](https://github.com/dropseed/plain/releases/plain-auth@0.20.6) (2025-10-22)
|
|
14
|
+
|
|
15
|
+
### What's changed
|
|
16
|
+
|
|
17
|
+
- Fixed impersonation check in `AuthViewMixin` to properly handle optional `plain-admin` dependency using `get_request_impersonator()` function instead of `getattr()` ([548a385](https://github.com/dropseed/plain/commit/548a3859f5))
|
|
18
|
+
|
|
19
|
+
### Upgrade instructions
|
|
20
|
+
|
|
21
|
+
- No changes required
|
|
22
|
+
|
|
3
23
|
## [0.20.5](https://github.com/dropseed/plain/releases/plain-auth@0.20.5) (2025-10-20)
|
|
4
24
|
|
|
5
25
|
### What's changed
|
|
@@ -23,6 +23,11 @@ from .utils import resolve_url
|
|
|
23
23
|
if TYPE_CHECKING:
|
|
24
24
|
from plain.http import Request
|
|
25
25
|
|
|
26
|
+
try:
|
|
27
|
+
from plain.admin.impersonate import get_request_impersonator
|
|
28
|
+
except ImportError:
|
|
29
|
+
get_request_impersonator: Any = None
|
|
30
|
+
|
|
26
31
|
|
|
27
32
|
class LoginRequired(Exception):
|
|
28
33
|
def __init__(self, login_url: str | None = None, redirect_field_name: str = "next"):
|
|
@@ -65,14 +70,17 @@ class AuthViewMixin(SessionViewMixin):
|
|
|
65
70
|
if self.admin_required:
|
|
66
71
|
# At this point, we know user is authenticated (from check above)
|
|
67
72
|
# Check if impersonation is active
|
|
68
|
-
if
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
if get_request_impersonator:
|
|
74
|
+
if impersonator := get_request_impersonator(self.request):
|
|
75
|
+
# Impersonators should be able to view admin pages while impersonating.
|
|
76
|
+
# There's probably never a case where an impersonator isn't admin, but it can be configured.
|
|
77
|
+
if not impersonator.is_admin:
|
|
78
|
+
raise PermissionDenied(
|
|
79
|
+
"You do not have permission to access this page."
|
|
80
|
+
)
|
|
81
|
+
return
|
|
82
|
+
|
|
83
|
+
if not self.user.is_admin:
|
|
76
84
|
# Show a 404 so we don't expose admin urls to non-admin users
|
|
77
85
|
raise Http404()
|
|
78
86
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "plain.auth"
|
|
3
|
-
version = "0.20.
|
|
3
|
+
version = "0.20.7"
|
|
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"
|
|
7
|
+
license = "BSD-3-Clause"
|
|
7
8
|
requires-python = ">=3.13"
|
|
8
9
|
dependencies = [
|
|
9
10
|
"plain<1.0.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|