cardo-python-utils 0.5.dev46__tar.gz → 0.5.dev48__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.
- {cardo_python_utils-0.5.dev46/cardo_python_utils.egg-info → cardo_python_utils-0.5.dev48}/PKG-INFO +1 -1
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48/cardo_python_utils.egg-info}/PKG-INFO +1 -1
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/cardo_python_utils.egg-info/SOURCES.txt +1 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/pyproject.toml +1 -1
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/README.md +5 -0
- cardo_python_utils-0.5.dev48/python_utils/django/migrations/0001_initial.py +115 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/migrations/0001_initial_squashed_0005_alter_userrole_id.py +9 -23
- cardo_python_utils-0.5.dev48/python_utils/django/migrations/0008_delete_userrole.py +25 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/oidc_settings.py +7 -7
- cardo_python_utils-0.5.dev46/python_utils/django/migrations/0001_initial.py +0 -73
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/LICENSE +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/MANIFEST.in +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/README.rst +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/cardo_python_utils.egg-info/dependency_links.txt +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/cardo_python_utils.egg-info/requires.txt +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/cardo_python_utils.egg-info/top_level.txt +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/choices.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/data_structures.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/db.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/admin/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/admin/auth.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/admin/templates/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/admin/templates/user_groups_changelist.html +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/admin/user_group.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/admin/views.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/api/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/api/drf.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/api/ninja.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/api/utils.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/apps.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/auth/service.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/celery/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/celery/tenant_aware_database_scheduler.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/celery/tenant_aware_task.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/db/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/db/alias.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/db/routers.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/db/transaction.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/db/utils.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/management/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/management/commands/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/management/commands/migrateall.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/management/commands/tenant_aware_command.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/middleware/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/middleware/tenant_aware_http_middleware.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/middleware/tenant_aware_websocket_middleware.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/migrations/0002_auto_20220120_1617.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/migrations/0003_auto_20220513_1025.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/migrations/0004_auto_20220817_1526.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/migrations/0005_alter_userrole_id.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/migrations/0006_userrole_organization_and_more.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/migrations/0007_user_demo.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/migrations/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/models/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/models/user.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/models/user_group.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/redis/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/redis/key_function.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/settings.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/storage/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/storage/tenant_aware_storage.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/tenant_context.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/tests/__init__.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/tests/conftest.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django_utils.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/esma_choices.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/exceptions.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/imports.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/math.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/text.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/time.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/types_hinting.py +0 -0
- {cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/setup.cfg +0 -0
|
@@ -59,6 +59,7 @@ python_utils/django/migrations/0004_auto_20220817_1526.py
|
|
|
59
59
|
python_utils/django/migrations/0005_alter_userrole_id.py
|
|
60
60
|
python_utils/django/migrations/0006_userrole_organization_and_more.py
|
|
61
61
|
python_utils/django/migrations/0007_user_demo.py
|
|
62
|
+
python_utils/django/migrations/0008_delete_userrole.py
|
|
62
63
|
python_utils/django/migrations/__init__.py
|
|
63
64
|
python_utils/django/models/__init__.py
|
|
64
65
|
python_utils/django/models/user.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cardo-python-utils"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.dev48"
|
|
8
8
|
description = "Python library enhanced with a wide range of functions for different scenarios."
|
|
9
9
|
readme = "README.rst"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -124,6 +124,11 @@ OIDC_AUTHENTICATE_CLASS = "python_utils.django.admin.views.TenantAwareOIDCAuthen
|
|
|
124
124
|
LOGIN_REDIRECT_URL = "/admin"
|
|
125
125
|
SESSION_COOKIE_AGE = 60 * 30 # 30 minutes
|
|
126
126
|
SESSION_SAVE_EVERY_REQUEST = True # Extend session on each request
|
|
127
|
+
|
|
128
|
+
# If using django-easy-audit
|
|
129
|
+
|
|
130
|
+
from python_utils.django.db.alias import DynamicDatabaseAlias
|
|
131
|
+
DJANGO_EASY_AUDIT_DATABASE_ALIAS = DynamicDatabaseAlias()
|
|
127
132
|
```
|
|
128
133
|
|
|
129
134
|
## urls.py file
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Generated by Django 3.1.13 on 2021-10-26 09:12
|
|
2
|
+
|
|
3
|
+
import django.contrib.auth.models
|
|
4
|
+
import django.contrib.auth.validators
|
|
5
|
+
import django.utils.timezone
|
|
6
|
+
from django.conf import settings
|
|
7
|
+
from django.db import migrations, models
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Migration(migrations.Migration):
|
|
11
|
+
initial = True
|
|
12
|
+
|
|
13
|
+
dependencies = [
|
|
14
|
+
("auth", "0012_alter_user_first_name_max_length"),
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
operations = [
|
|
18
|
+
migrations.CreateModel(
|
|
19
|
+
name="User",
|
|
20
|
+
fields=[
|
|
21
|
+
("password", models.CharField(max_length=128, verbose_name="password")),
|
|
22
|
+
("last_login", models.DateTimeField(blank=True, null=True, verbose_name="last login")),
|
|
23
|
+
(
|
|
24
|
+
"is_superuser",
|
|
25
|
+
models.BooleanField(
|
|
26
|
+
default=False,
|
|
27
|
+
help_text="Designates that this user has all permissions without explicitly assigning them.",
|
|
28
|
+
verbose_name="superuser status",
|
|
29
|
+
),
|
|
30
|
+
),
|
|
31
|
+
(
|
|
32
|
+
"username",
|
|
33
|
+
models.CharField(
|
|
34
|
+
error_messages={"unique": "A user with that username already exists."},
|
|
35
|
+
help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
|
|
36
|
+
max_length=150,
|
|
37
|
+
unique=True,
|
|
38
|
+
validators=[django.contrib.auth.validators.UnicodeUsernameValidator()],
|
|
39
|
+
verbose_name="username",
|
|
40
|
+
),
|
|
41
|
+
),
|
|
42
|
+
("first_name", models.CharField(blank=True, max_length=150, verbose_name="first name")),
|
|
43
|
+
("last_name", models.CharField(blank=True, max_length=150, verbose_name="last name")),
|
|
44
|
+
("email", models.EmailField(blank=True, max_length=254, verbose_name="email address")),
|
|
45
|
+
(
|
|
46
|
+
"is_staff",
|
|
47
|
+
models.BooleanField(
|
|
48
|
+
default=False,
|
|
49
|
+
help_text="Designates whether the user can log into this admin site.",
|
|
50
|
+
verbose_name="staff status",
|
|
51
|
+
),
|
|
52
|
+
),
|
|
53
|
+
(
|
|
54
|
+
"is_active",
|
|
55
|
+
models.BooleanField(
|
|
56
|
+
default=True,
|
|
57
|
+
help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
|
|
58
|
+
verbose_name="active",
|
|
59
|
+
),
|
|
60
|
+
),
|
|
61
|
+
("date_joined", models.DateTimeField(default=django.utils.timezone.now, verbose_name="date joined")),
|
|
62
|
+
("idp_user_id", models.BigIntegerField(primary_key=True, serialize=False)),
|
|
63
|
+
(
|
|
64
|
+
"groups",
|
|
65
|
+
models.ManyToManyField(
|
|
66
|
+
blank=True,
|
|
67
|
+
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
|
|
68
|
+
related_name="idp_user_set",
|
|
69
|
+
related_query_name="user",
|
|
70
|
+
to="auth.group",
|
|
71
|
+
verbose_name="groups",
|
|
72
|
+
),
|
|
73
|
+
),
|
|
74
|
+
(
|
|
75
|
+
"user_permissions",
|
|
76
|
+
models.ManyToManyField(
|
|
77
|
+
blank=True,
|
|
78
|
+
help_text="Specific permissions for this user.",
|
|
79
|
+
related_name="idp_user_set",
|
|
80
|
+
related_query_name="user",
|
|
81
|
+
to="auth.permission",
|
|
82
|
+
verbose_name="user permissions",
|
|
83
|
+
),
|
|
84
|
+
),
|
|
85
|
+
],
|
|
86
|
+
options={
|
|
87
|
+
"verbose_name": "user",
|
|
88
|
+
"verbose_name_plural": "users",
|
|
89
|
+
"abstract": False,
|
|
90
|
+
},
|
|
91
|
+
managers=[
|
|
92
|
+
("objects", django.contrib.auth.models.UserManager()),
|
|
93
|
+
],
|
|
94
|
+
),
|
|
95
|
+
migrations.CreateModel(
|
|
96
|
+
name="UserRole",
|
|
97
|
+
fields=[
|
|
98
|
+
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
99
|
+
("role", models.CharField(max_length=125)),
|
|
100
|
+
("app_config", models.JSONField(null=True)),
|
|
101
|
+
("permission_restrictions", models.JSONField(default=dict)),
|
|
102
|
+
(
|
|
103
|
+
"user",
|
|
104
|
+
models.ForeignKey(
|
|
105
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
106
|
+
related_name="user_roles",
|
|
107
|
+
to=settings.AUTH_USER_MODEL,
|
|
108
|
+
),
|
|
109
|
+
),
|
|
110
|
+
],
|
|
111
|
+
options={
|
|
112
|
+
"unique_together": {("user", "role")},
|
|
113
|
+
},
|
|
114
|
+
),
|
|
115
|
+
]
|
|
@@ -28,9 +28,7 @@ class Migration(migrations.Migration):
|
|
|
28
28
|
("password", models.CharField(max_length=128, verbose_name="password")),
|
|
29
29
|
(
|
|
30
30
|
"last_login",
|
|
31
|
-
models.DateTimeField(
|
|
32
|
-
blank=True, null=True, verbose_name="last login"
|
|
33
|
-
),
|
|
31
|
+
models.DateTimeField(blank=True, null=True, verbose_name="last login"),
|
|
34
32
|
),
|
|
35
33
|
(
|
|
36
34
|
"is_superuser",
|
|
@@ -43,35 +41,25 @@ class Migration(migrations.Migration):
|
|
|
43
41
|
(
|
|
44
42
|
"username",
|
|
45
43
|
models.CharField(
|
|
46
|
-
error_messages={
|
|
47
|
-
"unique": "A user with that username already exists."
|
|
48
|
-
},
|
|
44
|
+
error_messages={"unique": "A user with that username already exists."},
|
|
49
45
|
help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
|
|
50
46
|
max_length=150,
|
|
51
47
|
unique=True,
|
|
52
|
-
validators=[
|
|
53
|
-
django.contrib.auth.validators.UnicodeUsernameValidator()
|
|
54
|
-
],
|
|
48
|
+
validators=[django.contrib.auth.validators.UnicodeUsernameValidator()],
|
|
55
49
|
verbose_name="username",
|
|
56
50
|
),
|
|
57
51
|
),
|
|
58
52
|
(
|
|
59
53
|
"first_name",
|
|
60
|
-
models.CharField(
|
|
61
|
-
blank=True, max_length=150, verbose_name="first name"
|
|
62
|
-
),
|
|
54
|
+
models.CharField(blank=True, max_length=150, verbose_name="first name"),
|
|
63
55
|
),
|
|
64
56
|
(
|
|
65
57
|
"last_name",
|
|
66
|
-
models.CharField(
|
|
67
|
-
blank=True, max_length=150, verbose_name="last name"
|
|
68
|
-
),
|
|
58
|
+
models.CharField(blank=True, max_length=150, verbose_name="last name"),
|
|
69
59
|
),
|
|
70
60
|
(
|
|
71
61
|
"email",
|
|
72
|
-
models.EmailField(
|
|
73
|
-
blank=True, max_length=254, verbose_name="email address"
|
|
74
|
-
),
|
|
62
|
+
models.EmailField(blank=True, max_length=254, verbose_name="email address"),
|
|
75
63
|
),
|
|
76
64
|
(
|
|
77
65
|
"is_staff",
|
|
@@ -91,9 +79,7 @@ class Migration(migrations.Migration):
|
|
|
91
79
|
),
|
|
92
80
|
(
|
|
93
81
|
"date_joined",
|
|
94
|
-
models.DateTimeField(
|
|
95
|
-
default=django.utils.timezone.now, verbose_name="date joined"
|
|
96
|
-
),
|
|
82
|
+
models.DateTimeField(default=django.utils.timezone.now, verbose_name="date joined"),
|
|
97
83
|
),
|
|
98
84
|
(
|
|
99
85
|
"id",
|
|
@@ -109,7 +95,7 @@ class Migration(migrations.Migration):
|
|
|
109
95
|
models.ManyToManyField(
|
|
110
96
|
blank=True,
|
|
111
97
|
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
|
|
112
|
-
related_name="
|
|
98
|
+
related_name="idp_user_set",
|
|
113
99
|
related_query_name="user",
|
|
114
100
|
to="auth.group",
|
|
115
101
|
verbose_name="groups",
|
|
@@ -120,7 +106,7 @@ class Migration(migrations.Migration):
|
|
|
120
106
|
models.ManyToManyField(
|
|
121
107
|
blank=True,
|
|
122
108
|
help_text="Specific permissions for this user.",
|
|
123
|
-
related_name="
|
|
109
|
+
related_name="idp_user_set",
|
|
124
110
|
related_query_name="user",
|
|
125
111
|
to="auth.permission",
|
|
126
112
|
verbose_name="user permissions",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Generated by Django 5.0.8 on 2026-02-13 13:32
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
dependencies = [
|
|
8
|
+
("idp_user", "0007_user_demo"),
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
operations = [
|
|
12
|
+
migrations.SeparateDatabaseAndState(
|
|
13
|
+
state_operations=[
|
|
14
|
+
migrations.DeleteModel(
|
|
15
|
+
name="UserRole",
|
|
16
|
+
),
|
|
17
|
+
],
|
|
18
|
+
database_operations=[
|
|
19
|
+
migrations.RunSQL(
|
|
20
|
+
sql="DROP TABLE IF EXISTS idp_user_userrole;",
|
|
21
|
+
reverse_sql=migrations.RunSQL.noop,
|
|
22
|
+
),
|
|
23
|
+
],
|
|
24
|
+
),
|
|
25
|
+
]
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/oidc_settings.py
RENAMED
|
@@ -76,16 +76,16 @@ def get_confidential_client_service_account_token() -> str:
|
|
|
76
76
|
"""
|
|
77
77
|
Reads the Keycloak confidential client service account token for the current tenant from a file.
|
|
78
78
|
"""
|
|
79
|
-
|
|
80
|
-
token_file_path = KEYCLOAK_CONFIDENTIAL_CLIENT_SERVICE_ACCOUNT_TOKEN_FILE_PATHS.get(
|
|
79
|
+
realm = get_realm_for_tenant(TenantContext.get())
|
|
80
|
+
token_file_path = KEYCLOAK_CONFIDENTIAL_CLIENT_SERVICE_ACCOUNT_TOKEN_FILE_PATHS.get(realm)
|
|
81
81
|
if not token_file_path or not os.path.isfile(token_file_path):
|
|
82
|
-
raise FileNotFoundError(f"Keycloak service account token file for tenant {
|
|
82
|
+
raise FileNotFoundError(f"Keycloak service account token file for tenant {realm} not found: {token_file_path}")
|
|
83
83
|
|
|
84
84
|
with open(token_file_path, "r") as f:
|
|
85
85
|
token = f.read().strip()
|
|
86
86
|
|
|
87
87
|
if not token:
|
|
88
|
-
raise ValueError(f"Keycloak service account token for tenant {
|
|
88
|
+
raise ValueError(f"Keycloak service account token for tenant {realm} is empty.")
|
|
89
89
|
|
|
90
90
|
return token
|
|
91
91
|
|
|
@@ -94,10 +94,10 @@ def get_confidential_client_secret() -> str:
|
|
|
94
94
|
"""
|
|
95
95
|
Retrieves the Keycloak confidential client secret for the current tenant.
|
|
96
96
|
"""
|
|
97
|
-
|
|
98
|
-
client_secret = KEYCLOAK_CONFIDENTIAL_CLIENT_SECRETS.get(
|
|
97
|
+
realm = get_realm_for_tenant(TenantContext.get())
|
|
98
|
+
client_secret = KEYCLOAK_CONFIDENTIAL_CLIENT_SECRETS.get(realm)
|
|
99
99
|
if not client_secret:
|
|
100
|
-
raise ValueError(f"Keycloak confidential client secret for tenant {
|
|
100
|
+
raise ValueError(f"Keycloak confidential client secret for tenant {realm} not found.")
|
|
101
101
|
|
|
102
102
|
return client_secret
|
|
103
103
|
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# Generated by Django 3.1.13 on 2021-10-26 09:12
|
|
2
|
-
|
|
3
|
-
import django.contrib.auth.models
|
|
4
|
-
import django.contrib.auth.validators
|
|
5
|
-
import django.utils.timezone
|
|
6
|
-
from django.conf import settings
|
|
7
|
-
from django.db import migrations, models
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Migration(migrations.Migration):
|
|
11
|
-
initial = True
|
|
12
|
-
|
|
13
|
-
dependencies = [
|
|
14
|
-
('auth', '0012_alter_user_first_name_max_length'),
|
|
15
|
-
]
|
|
16
|
-
|
|
17
|
-
operations = [
|
|
18
|
-
migrations.CreateModel(
|
|
19
|
-
name='User',
|
|
20
|
-
fields=[
|
|
21
|
-
('password', models.CharField(max_length=128, verbose_name='password')),
|
|
22
|
-
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
|
|
23
|
-
('is_superuser', models.BooleanField(default=False,
|
|
24
|
-
help_text='Designates that this user has all permissions without explicitly assigning them.',
|
|
25
|
-
verbose_name='superuser status')),
|
|
26
|
-
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'},
|
|
27
|
-
help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
|
|
28
|
-
max_length=150, unique=True,
|
|
29
|
-
validators=[django.contrib.auth.validators.UnicodeUsernameValidator()],
|
|
30
|
-
verbose_name='username')),
|
|
31
|
-
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
|
|
32
|
-
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
|
|
33
|
-
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
|
|
34
|
-
('is_staff', models.BooleanField(default=False,
|
|
35
|
-
help_text='Designates whether the user can log into this admin site.',
|
|
36
|
-
verbose_name='staff status')),
|
|
37
|
-
('is_active', models.BooleanField(default=True,
|
|
38
|
-
help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
|
|
39
|
-
verbose_name='active')),
|
|
40
|
-
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
|
41
|
-
('idp_user_id', models.BigIntegerField(primary_key=True, serialize=False)),
|
|
42
|
-
('groups', models.ManyToManyField(blank=True,
|
|
43
|
-
help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.',
|
|
44
|
-
related_name='user_set', related_query_name='user', to='auth.Group',
|
|
45
|
-
verbose_name='groups')),
|
|
46
|
-
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.',
|
|
47
|
-
related_name='user_set', related_query_name='user',
|
|
48
|
-
to='auth.Permission', verbose_name='user permissions')),
|
|
49
|
-
],
|
|
50
|
-
options={
|
|
51
|
-
'verbose_name': 'user',
|
|
52
|
-
'verbose_name_plural': 'users',
|
|
53
|
-
'abstract': False,
|
|
54
|
-
},
|
|
55
|
-
managers=[
|
|
56
|
-
('objects', django.contrib.auth.models.UserManager()),
|
|
57
|
-
],
|
|
58
|
-
),
|
|
59
|
-
migrations.CreateModel(
|
|
60
|
-
name='UserRole',
|
|
61
|
-
fields=[
|
|
62
|
-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
63
|
-
('role', models.CharField(max_length=125)),
|
|
64
|
-
('app_config', models.JSONField(null=True)),
|
|
65
|
-
('permission_restrictions', models.JSONField(default=dict)),
|
|
66
|
-
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_roles',
|
|
67
|
-
to=settings.AUTH_USER_MODEL)),
|
|
68
|
-
],
|
|
69
|
-
options={
|
|
70
|
-
'unique_together': {('user', 'role')},
|
|
71
|
-
},
|
|
72
|
-
),
|
|
73
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/data_structures.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/admin/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/admin/auth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/admin/views.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/api/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/api/drf.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/api/ninja.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/api/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/auth/service.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/celery/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/db/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/db/alias.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/db/routers.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/db/transaction.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/db/utils.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
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/models/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/models/user.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/redis/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/settings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/tenant_context.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/tests/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev46 → cardo_python_utils-0.5.dev48}/python_utils/django/tests/conftest.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
|