bazis-users 2.3.0__tar.gz → 2.3.2__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.
- {bazis_users-2.3.0 → bazis_users-2.3.2}/.github/workflows/release.yml +5 -2
- {bazis_users-2.3.0 → bazis_users-2.3.2}/.github/workflows/tests.yml +1 -1
- {bazis_users-2.3.0 → bazis_users-2.3.2}/CLAUDE.md +1 -1
- {bazis_users-2.3.0 → bazis_users-2.3.2}/PKG-INFO +2 -2
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/_version.py +3 -3
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/conf.py +5 -1
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis_users.egg-info/PKG-INFO +2 -2
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis_users.egg-info/SOURCES.txt +2 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis_users.egg-info/requires.txt +1 -1
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis_users.egg-info/scm_file_list.json +2 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis_users.egg-info/scm_version.json +2 -2
- bazis_users-2.3.2/docs/releases/2.3.1.md +6 -0
- bazis_users-2.3.2/docs/releases/2.3.2.md +6 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/pyproject.toml +1 -1
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/sample/main.py +1 -1
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/sample/settings.py +1 -1
- {bazis_users-2.3.0 → bazis_users-2.3.2}/tests/test_tokens.py +28 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/.dockerignore +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/.github/workflows/build-publish.yml +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/.github/workflows/update-licenses.yml +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/.gitignore +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/README.md +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/__init__.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/admin_abstract.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/apps.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/locale/en/LC_MESSAGES/django.mo +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/locale/en/LC_MESSAGES/django.po +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/locale/ru/LC_MESSAGES/django.mo +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/locale/ru/LC_MESSAGES/django.po +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/middleware.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/migrations/0001_initial.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/migrations/0002_user_dt_first_login.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/migrations/__init__.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/models.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/models_abstract.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/router.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/routes.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/routes_abstract.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/schemas.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/service.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis_users.egg-info/dependency_links.txt +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/bazis_users.egg-info/top_level.txt +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/Makefile +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/README.md +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/_static/pydata-custom.css +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/_static/readthedocs-custom.css +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/_templates/custom-class-template.rst +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/_templates/custom-module-template.rst +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/conf.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/index.rst +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/make.bat +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/manage.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/project.env +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/releases/2.3.0.md +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/requirements.txt +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/settings.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/docs/structure.rst +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/pytest.ini +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/deploy/admin.sh +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/deploy/app.sh +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/deploy/config/admin.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/deploy/config/app.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/deploy/db.sh +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/deploy/init.sh +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/entity/__init__.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/entity/admin.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/entity/migrations/0001_initial.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/entity/migrations/0002_alter_childentity_dt_created_and_more.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/entity/migrations/__init__.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/entity/models.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/entity/router.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/entity/routes.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/manage.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/project.env +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/pyproject.toml +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/sample/__init__.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/sample/router.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/sample/urls.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/sample/wsgi.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/users/__init__.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/users/admin.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/users/apps.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/users/migrations/0001_initial.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/users/migrations/0002_user_dt_first_login.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/users/migrations/__init__.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/users/models.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/users/router.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/sample/uv.lock +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/setup.cfg +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/tests/__init__.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/tests/conftest.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/tests/factories.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/tests/test_protected.py +0 -0
- {bazis_users-2.3.0 → bazis_users-2.3.2}/tests/test_users.py +0 -0
|
@@ -42,9 +42,12 @@ jobs:
|
|
|
42
42
|
echo "::error::Tag v$VERSION already exists"
|
|
43
43
|
exit 1
|
|
44
44
|
fi
|
|
45
|
-
|
|
45
|
+
# versionsort.suffix: a pre-release (v2.4.0-rc1) sorts before its release (v2.4.0)
|
|
46
|
+
LAST_TAG=$(git -c versionsort.suffix=- tag --list 'v*' --sort=-v:refname | head -n 1)
|
|
46
47
|
echo "Last release: ${LAST_TAG:-none}, new release: v$VERSION"
|
|
47
|
-
|
|
48
|
+
# sort -V orders "~" before anything, as versionsort.suffix does with "-"
|
|
49
|
+
NEWEST=$(printf '%s\n%s\n' "${LAST_TAG#v}" "$VERSION" | sed 's/-/~/' | sort -V | tail -n 1)
|
|
50
|
+
if [ -n "$LAST_TAG" ] && [ "$NEWEST" != "${VERSION/-/\~}" ]; then
|
|
48
51
|
echo "::error::Version $VERSION is not newer than $LAST_TAG"
|
|
49
52
|
exit 1
|
|
50
53
|
fi
|
|
@@ -29,7 +29,7 @@ BS_MEDIA_ROOT=/tmp/bazis/media BS_STATIC_ROOT=/tmp/bazis/static BS_WEBAPP_ROOT=/
|
|
|
29
29
|
python -m pytest ../tests -o addopts="" -p no:cacheprovider
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Lint: `ruff check bazis tests`. CI also runs `python manage.py makemigrations --check
|
|
32
|
+
Lint: `ruff check bazis tests sample`. CI also runs `python manage.py makemigrations --check
|
|
33
33
|
--dry-run` in `sample`: commit the migrations of model changes, including the sample apps.
|
|
34
34
|
|
|
35
35
|
## Releasing
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bazis-users
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: User management module for Bazis framework.
|
|
5
5
|
Author-email: Ilya Kharyn <ilya.tt07@gmail.com>
|
|
6
6
|
Maintainer-email: Ilya Kharyn <ilya.tt07@gmail.com>
|
|
@@ -17,7 +17,7 @@ Classifier: Framework :: Django
|
|
|
17
17
|
Classifier: Framework :: FastAPI
|
|
18
18
|
Requires-Python: >=3.12
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
|
-
Requires-Dist: bazis>=2.3.
|
|
20
|
+
Requires-Dist: bazis>=2.3.1
|
|
21
21
|
Requires-Dist: python-multipart>=0.0.18
|
|
22
22
|
Requires-Dist: PyJWT>=2.10
|
|
23
23
|
Provides-Extra: test
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.3.
|
|
22
|
-
__version_tuple__ = version_tuple = (2, 3,
|
|
21
|
+
__version__ = version = '2.3.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 3, 2)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'gfa5e68bf1'
|
|
@@ -38,7 +38,11 @@ class Settings(BazisSettings):
|
|
|
38
38
|
BAZIS_JWT_SESSION_ALG: Literal['HS256', 'HS384', 'HS512'] = Field(
|
|
39
39
|
'HS256', title=_('JWT algorithm')
|
|
40
40
|
)
|
|
41
|
-
BAZIS_JWT_SESSION_LIFETIME: int = Field(
|
|
41
|
+
BAZIS_JWT_SESSION_LIFETIME: int = Field(
|
|
42
|
+
86400,
|
|
43
|
+
title=_('JWT lifetime'),
|
|
44
|
+
json_schema_extra={'dynamic': True},
|
|
45
|
+
)
|
|
42
46
|
|
|
43
47
|
|
|
44
48
|
settings = Settings()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bazis-users
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: User management module for Bazis framework.
|
|
5
5
|
Author-email: Ilya Kharyn <ilya.tt07@gmail.com>
|
|
6
6
|
Maintainer-email: Ilya Kharyn <ilya.tt07@gmail.com>
|
|
@@ -17,7 +17,7 @@ Classifier: Framework :: Django
|
|
|
17
17
|
Classifier: Framework :: FastAPI
|
|
18
18
|
Requires-Python: >=3.12
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
|
-
Requires-Dist: bazis>=2.3.
|
|
20
|
+
Requires-Dist: bazis>=2.3.1
|
|
21
21
|
Requires-Dist: python-multipart>=0.0.18
|
|
22
22
|
Requires-Dist: PyJWT>=2.10
|
|
23
23
|
Provides-Extra: test
|
|
@@ -50,6 +50,8 @@ docs/_static/readthedocs-custom.css
|
|
|
50
50
|
docs/_templates/custom-class-template.rst
|
|
51
51
|
docs/_templates/custom-module-template.rst
|
|
52
52
|
docs/releases/2.3.0.md
|
|
53
|
+
docs/releases/2.3.1.md
|
|
54
|
+
docs/releases/2.3.2.md
|
|
53
55
|
sample/manage.py
|
|
54
56
|
sample/project.env
|
|
55
57
|
sample/pyproject.toml
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# bazis-users 2.3.1
|
|
2
|
+
|
|
3
|
+
- Requires Bazis 2.3.1. Its relationships endpoints changed any relation of any object:
|
|
4
|
+
every authenticated user could add himself to Django groups or permissions with
|
|
5
|
+
`POST /users/user/<id>/relationships/groups` (or `user_permissions`), which the user
|
|
6
|
+
schema excludes. A test now checks that both are refused.
|
|
@@ -133,3 +133,31 @@ def test_token_without_expiration_is_anonymous(sample_app, user):
|
|
|
133
133
|
token = _token({'sub': user.username})
|
|
134
134
|
assert get_token_data(token_header=None, token_param=None, token_cookie=token) == {}
|
|
135
135
|
assert _get_me(sample_app, token).status_code == 401
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@pytest.mark.django_db(transaction=True)
|
|
139
|
+
def test_user_cannot_grant_himself_groups(sample_app, user):
|
|
140
|
+
"""
|
|
141
|
+
groups and user_permissions are excluded from the user schema: the relationships
|
|
142
|
+
endpoints must not change them (privilege escalation through Django permissions).
|
|
143
|
+
"""
|
|
144
|
+
from django.contrib.auth.models import Group, Permission
|
|
145
|
+
|
|
146
|
+
admins = Group.objects.create(name='admins')
|
|
147
|
+
admins.permissions.set(Permission.objects.all())
|
|
148
|
+
client = get_api_client(sample_app, user.jwt_build())
|
|
149
|
+
|
|
150
|
+
response = client.post(
|
|
151
|
+
f'/api/v1/users/user/{user.id}/relationships/groups',
|
|
152
|
+
json_data={'data': [{'id': str(admins.id), 'type': 'auth.group'}]},
|
|
153
|
+
)
|
|
154
|
+
assert response.status_code == 403
|
|
155
|
+
assert not user.groups.exists()
|
|
156
|
+
|
|
157
|
+
permission = Permission.objects.first()
|
|
158
|
+
response = client.post(
|
|
159
|
+
f'/api/v1/users/user/{user.id}/relationships/user_permissions',
|
|
160
|
+
json_data={'data': [{'id': str(permission.id), 'type': 'auth.permission'}]},
|
|
161
|
+
)
|
|
162
|
+
assert response.status_code == 403
|
|
163
|
+
assert not user.user_permissions.exists()
|
|
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
|
{bazis_users-2.3.0 → bazis_users-2.3.2}/bazis/contrib/users/migrations/0002_user_dt_first_login.py
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|