dbca-utils 2.1.5__tar.gz → 2.2.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,31 +1,29 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dbca-utils
3
- Version: 2.1.5
3
+ Version: 2.2.0
4
4
  Summary: Utilities for DBCA Django apps
5
5
  Author-Email: Rocky Chen <rocky.chen@dbca.wa.gov.au>, Ashley Felton <ashley.felton@dbca.wa.gov.au>
6
6
  License-Expression: Apache-2.0
7
7
  Classifier: Framework :: Django
8
- Classifier: Framework :: Django :: 4.2
9
- Classifier: Framework :: Django :: 5.0
10
8
  Classifier: Framework :: Django :: 5.2
9
+ Classifier: Framework :: Django :: 6.0
11
10
  Classifier: Environment :: Web Environment
12
11
  Classifier: Intended Audience :: Developers
13
12
  Classifier: Development Status :: 5 - Production/Stable
14
13
  Classifier: Programming Language :: Python
15
14
  Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3.10
17
- Classifier: Programming Language :: Python :: 3.11
18
15
  Classifier: Programming Language :: Python :: 3.12
19
16
  Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
20
18
  Classifier: Topic :: Software Development :: Libraries
21
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
20
  Project-URL: Homepage, https://github.com/dbca-wa/dbca-utils
23
21
  Project-URL: Repository, https://github.com/dbca-wa/dbca-utils.git
24
- Project-URL: Changelog, https://github.com/dbca-wa/dbca-utils/blob/master/CHANGELOG.md
22
+ Project-URL: Changelog, https://github.com/dbca-wa/dbca-utils/blob/main/CHANGELOG.md
25
23
  Project-URL: GitHub, https://github.com/dbca-wa/dbca-utils
26
- Requires-Python: <4.0,>=3.10
27
- Requires-Dist: django<6,>=4.2
28
- Requires-Dist: markupsafe==3.0.3
24
+ Requires-Python: <4.0,>=3.12
25
+ Requires-Dist: django<6.2,>=5.2
26
+ Requires-Dist: markupsafe>=3.0.3
29
27
  Description-Content-Type: text/markdown
30
28
 
31
29
  # Overview
@@ -34,8 +32,8 @@ DBCA Django utility classes and functions.
34
32
 
35
33
  ## Requirements
36
34
 
37
- - Python 3.10 or later
38
- - Django 4.2 or later
35
+ - Python 3.12 or later
36
+ - Django 5.2 or later
39
37
 
40
38
  ## Development
41
39
 
@@ -4,8 +4,8 @@ DBCA Django utility classes and functions.
4
4
 
5
5
  ## Requirements
6
6
 
7
- - Python 3.10 or later
8
- - Django 4.2 or later
7
+ - Python 3.12 or later
8
+ - Django 5.2 or later
9
9
 
10
10
  ## Development
11
11
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dbca-utils"
3
- version = "2.1.5"
3
+ version = "2.2.0"
4
4
  description = "Utilities for DBCA Django apps"
5
5
  authors = [
6
6
  { name = "Rocky Chen", email = "rocky.chen@dbca.wa.gov.au" },
@@ -10,39 +10,37 @@ readme = "README.md"
10
10
  license = "Apache-2.0"
11
11
  classifiers = [
12
12
  "Framework :: Django",
13
- "Framework :: Django :: 4.2",
14
- "Framework :: Django :: 5.0",
15
13
  "Framework :: Django :: 5.2",
14
+ "Framework :: Django :: 6.0",
16
15
  "Environment :: Web Environment",
17
16
  "Intended Audience :: Developers",
18
17
  "Development Status :: 5 - Production/Stable",
19
18
  "Programming Language :: Python",
20
19
  "Programming Language :: Python :: 3",
21
- "Programming Language :: Python :: 3.10",
22
- "Programming Language :: Python :: 3.11",
23
20
  "Programming Language :: Python :: 3.12",
24
21
  "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
25
23
  "Topic :: Software Development :: Libraries",
26
24
  "Topic :: Software Development :: Libraries :: Python Modules",
27
25
  ]
28
- requires-python = ">=3.10,<4.0"
26
+ requires-python = ">=3.12,<4.0"
29
27
  dependencies = [
30
- "django>=4.2,<6",
31
- "markupsafe==3.0.3",
28
+ "django>=5.2,<6.2",
29
+ "markupsafe>=3.0.3",
32
30
  ]
33
31
 
34
32
  [project.urls]
35
33
  Homepage = "https://github.com/dbca-wa/dbca-utils"
36
34
  Repository = "https://github.com/dbca-wa/dbca-utils.git"
37
- Changelog = "https://github.com/dbca-wa/dbca-utils/blob/master/CHANGELOG.md"
35
+ Changelog = "https://github.com/dbca-wa/dbca-utils/blob/main/CHANGELOG.md"
38
36
  GitHub = "https://github.com/dbca-wa/dbca-utils"
39
37
 
40
38
  [dependency-groups]
41
39
  dev = [
42
- "pytest-django>=4.11.1",
40
+ "pytest-django>=4.12.0",
43
41
  "pytest-sugar>=1.1.1",
44
- "tox>=4.31.0",
45
- "tox-uv>=1.29.0",
42
+ "tox>=4.53.0",
43
+ "tox-uv>=1.35.0",
46
44
  ]
47
45
 
48
46
  [build-system]
@@ -116,7 +116,7 @@ class SSOLoginMiddleware(MiddlewareMixin):
116
116
  # Security check: if the logged-in request user's email does not match the email
117
117
  # returned from Auth2, invalidate the current request session and force a new session
118
118
  # using the returned SSO values.
119
- if request.user.is_authenticated and request.user.email != request.META["HTTP_X_EMAIL"]:
119
+ if request.user.is_authenticated and request.user.email != request.META.get("HTTP_X_EMAIL", ""):
120
120
  logout(request)
121
121
 
122
122
  # Request user is not authenticated locally: obtain user attributes from the request.META dict
@@ -128,7 +128,7 @@ class SSOLoginMiddleware(MiddlewareMixin):
128
128
  "last_name": "HTTP_X_LAST_NAME",
129
129
  "first_name": "HTTP_X_FIRST_NAME",
130
130
  }
131
- attributes = {"email": "", "username": ""}
131
+ attributes = {"username": ""}
132
132
 
133
133
  for key, meta_value in attributemap.items():
134
134
  if meta_value in request.META:
@@ -147,11 +147,15 @@ class SSOLoginMiddleware(MiddlewareMixin):
147
147
  # a list of strings, or a single string.
148
148
  if hasattr(settings, "ALLOWED_EMAIL_SUFFIXES") and settings.ALLOWED_EMAIL_SUFFIXES:
149
149
  if isinstance(settings.ALLOWED_EMAIL_SUFFIXES, str):
150
- allowed_email_suffixes = list(settings.ALLOWED_EMAIL_SUFFIXES)
150
+ # If configured as a string, ALLOWED_EMAIL_SUFFIXES must be a comma-separated list (single-item list is OK).
151
+ allowed_email_suffixes = settings.ALLOWED_EMAIL_SUFFIXES.split(",")
151
152
  else:
152
153
  allowed_email_suffixes = settings.ALLOWED_EMAIL_SUFFIXES
154
+ # Validation: allowed_email_suffixes must be a list of strings.
155
+ if not (isinstance(allowed_email_suffixes, list) and all(isinstance(x, str) for x in allowed_email_suffixes)):
156
+ raise ValueError("ALLOWED_EMAIL_SUFFIXES must be a list of strings")
153
157
  # If the user email suffix is not in the allowed list, return a 404 response.
154
- if not any([attributes["email"].lower().endswith(suffix) for suffix in allowed_email_suffixes]):
158
+ if not any([attributes["email"].lower().endswith(suffix.lower().strip()) for suffix in allowed_email_suffixes]):
155
159
  return http.HttpResponseForbidden()
156
160
 
157
161
  # Check for an existing User instance.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes