cardo-python-utils 0.5.dev44__tar.gz → 0.5.dev46__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.dev44/cardo_python_utils.egg-info → cardo_python_utils-0.5.dev46}/PKG-INFO +1 -1
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46/cardo_python_utils.egg-info}/PKG-INFO +1 -1
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/cardo_python_utils.egg-info/SOURCES.txt +8 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/pyproject.toml +1 -1
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/README.md +2 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/apps.py +1 -0
- cardo_python_utils-0.5.dev46/python_utils/django/db/alias.py +22 -0
- cardo_python_utils-0.5.dev46/python_utils/django/migrations/0001_initial.py +73 -0
- cardo_python_utils-0.5.dev46/python_utils/django/migrations/0001_initial_squashed_0005_alter_userrole_id.py +167 -0
- cardo_python_utils-0.5.dev46/python_utils/django/migrations/0002_auto_20220120_1617.py +18 -0
- cardo_python_utils-0.5.dev46/python_utils/django/migrations/0003_auto_20220513_1025.py +18 -0
- cardo_python_utils-0.5.dev46/python_utils/django/migrations/0004_auto_20220817_1526.py +23 -0
- cardo_python_utils-0.5.dev46/python_utils/django/migrations/0005_alter_userrole_id.py +18 -0
- cardo_python_utils-0.5.dev46/python_utils/django/migrations/0006_userrole_organization_and_more.py +31 -0
- cardo_python_utils-0.5.dev46/python_utils/django/migrations/0007_user_demo.py +15 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/migrations/__init__.py +0 -0
- cardo_python_utils-0.5.dev46/python_utils/django/models/__init__.py +3 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/models/user.py +0 -3
- cardo_python_utils-0.5.dev44/python_utils/django/migrations/0001_initial.py +0 -149
- cardo_python_utils-0.5.dev44/python_utils/django/models/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/LICENSE +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/MANIFEST.in +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/README.rst +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/cardo_python_utils.egg-info/dependency_links.txt +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/cardo_python_utils.egg-info/requires.txt +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/cardo_python_utils.egg-info/top_level.txt +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/choices.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/data_structures.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/db.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/admin/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/admin/auth.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/admin/templates/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/admin/templates/user_groups_changelist.html +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/admin/user_group.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/admin/views.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/api/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/api/drf.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/api/ninja.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/api/utils.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/auth/service.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/celery/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/celery/tenant_aware_database_scheduler.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/celery/tenant_aware_task.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/db/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/db/routers.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/db/transaction.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/db/utils.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/management/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/management/commands/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/management/commands/migrateall.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/management/commands/tenant_aware_command.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/middleware/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/middleware/tenant_aware_http_middleware.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/middleware/tenant_aware_websocket_middleware.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/models/user_group.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/oidc_settings.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/redis/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/redis/key_function.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/settings.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/storage/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/storage/tenant_aware_storage.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/tenant_context.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/tests/__init__.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/tests/conftest.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django_utils.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/esma_choices.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/exceptions.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/imports.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/math.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/text.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/time.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/types_hinting.py +0 -0
- {cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/setup.cfg +0 -0
|
@@ -40,6 +40,7 @@ python_utils/django/celery/__init__.py
|
|
|
40
40
|
python_utils/django/celery/tenant_aware_database_scheduler.py
|
|
41
41
|
python_utils/django/celery/tenant_aware_task.py
|
|
42
42
|
python_utils/django/db/__init__.py
|
|
43
|
+
python_utils/django/db/alias.py
|
|
43
44
|
python_utils/django/db/routers.py
|
|
44
45
|
python_utils/django/db/transaction.py
|
|
45
46
|
python_utils/django/db/utils.py
|
|
@@ -51,6 +52,13 @@ python_utils/django/middleware/__init__.py
|
|
|
51
52
|
python_utils/django/middleware/tenant_aware_http_middleware.py
|
|
52
53
|
python_utils/django/middleware/tenant_aware_websocket_middleware.py
|
|
53
54
|
python_utils/django/migrations/0001_initial.py
|
|
55
|
+
python_utils/django/migrations/0001_initial_squashed_0005_alter_userrole_id.py
|
|
56
|
+
python_utils/django/migrations/0002_auto_20220120_1617.py
|
|
57
|
+
python_utils/django/migrations/0003_auto_20220513_1025.py
|
|
58
|
+
python_utils/django/migrations/0004_auto_20220817_1526.py
|
|
59
|
+
python_utils/django/migrations/0005_alter_userrole_id.py
|
|
60
|
+
python_utils/django/migrations/0006_userrole_organization_and_more.py
|
|
61
|
+
python_utils/django/migrations/0007_user_demo.py
|
|
54
62
|
python_utils/django/migrations/__init__.py
|
|
55
63
|
python_utils/django/models/__init__.py
|
|
56
64
|
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.dev46"
|
|
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"
|
|
@@ -33,6 +33,8 @@ MIDDLEWARE = [
|
|
|
33
33
|
...
|
|
34
34
|
]
|
|
35
35
|
|
|
36
|
+
AUTH_USER_MODEL = "idp_user.User"
|
|
37
|
+
|
|
36
38
|
# Include the database configuration for each tenant in the DATABASES setting.
|
|
37
39
|
# You can use the get_database_configs() function from python_utils.django.db.utils as a helper.
|
|
38
40
|
from python_utils.django.db.utils import get_database_configs
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from ..tenant_context import TenantContext
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DynamicDatabaseAlias(str):
|
|
5
|
+
def __new__(cls):
|
|
6
|
+
# We initialize with a dummy value; the logic happens in the methods below
|
|
7
|
+
return super().__new__(cls, "default")
|
|
8
|
+
|
|
9
|
+
def __getattribute__(self, name):
|
|
10
|
+
return getattr(TenantContext.get(), name)
|
|
11
|
+
|
|
12
|
+
def __str__(self):
|
|
13
|
+
return TenantContext.get()
|
|
14
|
+
|
|
15
|
+
def __repr__(self):
|
|
16
|
+
return repr(self.__str__())
|
|
17
|
+
|
|
18
|
+
def __hash__(self):
|
|
19
|
+
return hash(self.__str__())
|
|
20
|
+
|
|
21
|
+
def __eq__(self, other):
|
|
22
|
+
return self.__str__() == str(other)
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
]
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Generated by Django 4.2 on 2023-04-16 23:27
|
|
2
|
+
|
|
3
|
+
import django.contrib.auth.models
|
|
4
|
+
import django.contrib.auth.validators
|
|
5
|
+
import django.db.models.deletion
|
|
6
|
+
import django.utils.timezone
|
|
7
|
+
from django.conf import settings
|
|
8
|
+
from django.db import migrations, models
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Migration(migrations.Migration):
|
|
12
|
+
replaces = [
|
|
13
|
+
("idp_user", "0001_initial"),
|
|
14
|
+
("idp_user", "0002_auto_20220120_1617"),
|
|
15
|
+
("idp_user", "0003_auto_20220513_1025"),
|
|
16
|
+
("idp_user", "0004_auto_20220817_1526"),
|
|
17
|
+
("idp_user", "0005_alter_userrole_id"),
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
dependencies = [
|
|
21
|
+
("auth", "0012_alter_user_first_name_max_length"),
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
operations = [
|
|
25
|
+
migrations.CreateModel(
|
|
26
|
+
name="User",
|
|
27
|
+
fields=[
|
|
28
|
+
("password", models.CharField(max_length=128, verbose_name="password")),
|
|
29
|
+
(
|
|
30
|
+
"last_login",
|
|
31
|
+
models.DateTimeField(
|
|
32
|
+
blank=True, null=True, verbose_name="last login"
|
|
33
|
+
),
|
|
34
|
+
),
|
|
35
|
+
(
|
|
36
|
+
"is_superuser",
|
|
37
|
+
models.BooleanField(
|
|
38
|
+
default=False,
|
|
39
|
+
help_text="Designates that this user has all permissions without explicitly assigning them.",
|
|
40
|
+
verbose_name="superuser status",
|
|
41
|
+
),
|
|
42
|
+
),
|
|
43
|
+
(
|
|
44
|
+
"username",
|
|
45
|
+
models.CharField(
|
|
46
|
+
error_messages={
|
|
47
|
+
"unique": "A user with that username already exists."
|
|
48
|
+
},
|
|
49
|
+
help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
|
|
50
|
+
max_length=150,
|
|
51
|
+
unique=True,
|
|
52
|
+
validators=[
|
|
53
|
+
django.contrib.auth.validators.UnicodeUsernameValidator()
|
|
54
|
+
],
|
|
55
|
+
verbose_name="username",
|
|
56
|
+
),
|
|
57
|
+
),
|
|
58
|
+
(
|
|
59
|
+
"first_name",
|
|
60
|
+
models.CharField(
|
|
61
|
+
blank=True, max_length=150, verbose_name="first name"
|
|
62
|
+
),
|
|
63
|
+
),
|
|
64
|
+
(
|
|
65
|
+
"last_name",
|
|
66
|
+
models.CharField(
|
|
67
|
+
blank=True, max_length=150, verbose_name="last name"
|
|
68
|
+
),
|
|
69
|
+
),
|
|
70
|
+
(
|
|
71
|
+
"email",
|
|
72
|
+
models.EmailField(
|
|
73
|
+
blank=True, max_length=254, verbose_name="email address"
|
|
74
|
+
),
|
|
75
|
+
),
|
|
76
|
+
(
|
|
77
|
+
"is_staff",
|
|
78
|
+
models.BooleanField(
|
|
79
|
+
default=False,
|
|
80
|
+
help_text="Designates whether the user can log into this admin site.",
|
|
81
|
+
verbose_name="staff status",
|
|
82
|
+
),
|
|
83
|
+
),
|
|
84
|
+
(
|
|
85
|
+
"is_active",
|
|
86
|
+
models.BooleanField(
|
|
87
|
+
default=True,
|
|
88
|
+
help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
|
|
89
|
+
verbose_name="active",
|
|
90
|
+
),
|
|
91
|
+
),
|
|
92
|
+
(
|
|
93
|
+
"date_joined",
|
|
94
|
+
models.DateTimeField(
|
|
95
|
+
default=django.utils.timezone.now, verbose_name="date joined"
|
|
96
|
+
),
|
|
97
|
+
),
|
|
98
|
+
(
|
|
99
|
+
"id",
|
|
100
|
+
models.BigAutoField(
|
|
101
|
+
auto_created=True,
|
|
102
|
+
primary_key=True,
|
|
103
|
+
serialize=False,
|
|
104
|
+
verbose_name="ID",
|
|
105
|
+
),
|
|
106
|
+
),
|
|
107
|
+
(
|
|
108
|
+
"groups",
|
|
109
|
+
models.ManyToManyField(
|
|
110
|
+
blank=True,
|
|
111
|
+
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
|
|
112
|
+
related_name="user_set",
|
|
113
|
+
related_query_name="user",
|
|
114
|
+
to="auth.group",
|
|
115
|
+
verbose_name="groups",
|
|
116
|
+
),
|
|
117
|
+
),
|
|
118
|
+
(
|
|
119
|
+
"user_permissions",
|
|
120
|
+
models.ManyToManyField(
|
|
121
|
+
blank=True,
|
|
122
|
+
help_text="Specific permissions for this user.",
|
|
123
|
+
related_name="user_set",
|
|
124
|
+
related_query_name="user",
|
|
125
|
+
to="auth.permission",
|
|
126
|
+
verbose_name="user permissions",
|
|
127
|
+
),
|
|
128
|
+
),
|
|
129
|
+
],
|
|
130
|
+
options={
|
|
131
|
+
"verbose_name": "user",
|
|
132
|
+
"verbose_name_plural": "users",
|
|
133
|
+
"abstract": False,
|
|
134
|
+
},
|
|
135
|
+
managers=[
|
|
136
|
+
("objects", django.contrib.auth.models.UserManager()),
|
|
137
|
+
],
|
|
138
|
+
),
|
|
139
|
+
migrations.CreateModel(
|
|
140
|
+
name="UserRole",
|
|
141
|
+
fields=[
|
|
142
|
+
(
|
|
143
|
+
"id",
|
|
144
|
+
models.BigAutoField(
|
|
145
|
+
auto_created=True,
|
|
146
|
+
primary_key=True,
|
|
147
|
+
serialize=False,
|
|
148
|
+
verbose_name="ID",
|
|
149
|
+
),
|
|
150
|
+
),
|
|
151
|
+
("role", models.CharField(max_length=140)),
|
|
152
|
+
("app_entities_restrictions", models.JSONField(null=True)),
|
|
153
|
+
("permission_restrictions", models.JSONField(default=dict)),
|
|
154
|
+
(
|
|
155
|
+
"user",
|
|
156
|
+
models.ForeignKey(
|
|
157
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
158
|
+
related_name="user_roles",
|
|
159
|
+
to=settings.AUTH_USER_MODEL,
|
|
160
|
+
),
|
|
161
|
+
),
|
|
162
|
+
],
|
|
163
|
+
options={
|
|
164
|
+
"unique_together": {("user", "role")},
|
|
165
|
+
},
|
|
166
|
+
),
|
|
167
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 3.1.14 on 2022-01-20 16:17
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
('idp_user', '0001_initial'),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name='userrole',
|
|
15
|
+
name='role',
|
|
16
|
+
field=models.CharField(max_length=140),
|
|
17
|
+
),
|
|
18
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 3.1.14 on 2022-05-13 10:25
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
('idp_user', '0002_auto_20220120_1617'),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.RenameField(
|
|
14
|
+
model_name='userrole',
|
|
15
|
+
old_name='app_config',
|
|
16
|
+
new_name='app_entities_restrictions',
|
|
17
|
+
),
|
|
18
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by Django 4.0.6 on 2022-08-17 15:26
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
('idp_user', '0003_auto_20220513_1025'),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.RenameField(
|
|
14
|
+
model_name='user',
|
|
15
|
+
old_name='idp_user_id',
|
|
16
|
+
new_name='id',
|
|
17
|
+
),
|
|
18
|
+
migrations.AlterField(
|
|
19
|
+
model_name='user',
|
|
20
|
+
name='id',
|
|
21
|
+
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
|
22
|
+
),
|
|
23
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 4.0.6 on 2022-08-18 10:03
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
('idp_user', '0004_auto_20220817_1526'),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name='userrole',
|
|
15
|
+
name='id',
|
|
16
|
+
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
|
17
|
+
),
|
|
18
|
+
]
|
cardo_python_utils-0.5.dev46/python_utils/django/migrations/0006_userrole_organization_and_more.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Generated by Django 5.0.2 on 2024-03-19 08:54
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
dependencies = [
|
|
8
|
+
('idp_user', '0001_initial_squashed_0005_alter_userrole_id'),
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
operations = [
|
|
12
|
+
migrations.AddField(
|
|
13
|
+
model_name='userrole',
|
|
14
|
+
name='organization',
|
|
15
|
+
field=models.CharField(help_text='The name of the organization the user role belongs to, if any.',
|
|
16
|
+
max_length=140, null=True),
|
|
17
|
+
),
|
|
18
|
+
migrations.AlterField(
|
|
19
|
+
model_name='userrole',
|
|
20
|
+
name='app_entities_restrictions',
|
|
21
|
+
field=models.JSONField(
|
|
22
|
+
help_text='This dictionary contains explicit restrictions about the app entities that the user can access, in the form: {<entity_type>: [1, 2]}',
|
|
23
|
+
null=True),
|
|
24
|
+
),
|
|
25
|
+
migrations.AlterField(
|
|
26
|
+
model_name='userrole',
|
|
27
|
+
name='permission_restrictions',
|
|
28
|
+
field=models.JSONField(default=dict,
|
|
29
|
+
help_text="This dictionary contains explicit restrictions regarding app permissions, in the form: {'perform_operation_1': {'entity_type': [1, 2]}, 'perform_operation_2': false}"),
|
|
30
|
+
),
|
|
31
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from django.db import migrations, models
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Migration(migrations.Migration):
|
|
5
|
+
dependencies = [
|
|
6
|
+
('idp_user', '0006_userrole_organization_and_more'),
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
operations = [
|
|
10
|
+
migrations.AddField(
|
|
11
|
+
model_name='user',
|
|
12
|
+
name='is_demo',
|
|
13
|
+
field=models.BooleanField(default=False, help_text='Whether this user is a demo user.'),
|
|
14
|
+
),
|
|
15
|
+
]
|
|
File without changes
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import django.contrib.auth.models
|
|
2
|
-
import django.contrib.auth.validators
|
|
3
|
-
import django.utils.timezone
|
|
4
|
-
from django.db import migrations, models
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Migration(migrations.Migration):
|
|
8
|
-
initial = True
|
|
9
|
-
|
|
10
|
-
dependencies = [
|
|
11
|
-
("auth", "0012_alter_user_first_name_max_length"),
|
|
12
|
-
]
|
|
13
|
-
|
|
14
|
-
operations = [
|
|
15
|
-
migrations.SeparateDatabaseAndState(
|
|
16
|
-
state_operations=[
|
|
17
|
-
migrations.CreateModel(
|
|
18
|
-
name="User",
|
|
19
|
-
fields=[
|
|
20
|
-
(
|
|
21
|
-
"id",
|
|
22
|
-
models.AutoField(
|
|
23
|
-
auto_created=True,
|
|
24
|
-
primary_key=True,
|
|
25
|
-
serialize=False,
|
|
26
|
-
verbose_name="ID",
|
|
27
|
-
),
|
|
28
|
-
),
|
|
29
|
-
(
|
|
30
|
-
"password",
|
|
31
|
-
models.CharField(max_length=128, verbose_name="password"),
|
|
32
|
-
),
|
|
33
|
-
(
|
|
34
|
-
"last_login",
|
|
35
|
-
models.DateTimeField(blank=True, null=True, verbose_name="last login"),
|
|
36
|
-
),
|
|
37
|
-
(
|
|
38
|
-
"is_superuser",
|
|
39
|
-
models.BooleanField(
|
|
40
|
-
default=False,
|
|
41
|
-
help_text=(
|
|
42
|
-
"Designates that this user has all permissions without explicitly assigning them."
|
|
43
|
-
),
|
|
44
|
-
verbose_name="superuser status",
|
|
45
|
-
),
|
|
46
|
-
),
|
|
47
|
-
(
|
|
48
|
-
"username",
|
|
49
|
-
models.CharField(
|
|
50
|
-
error_messages={"unique": "A user with that username already exists."},
|
|
51
|
-
help_text=("Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only."),
|
|
52
|
-
max_length=150,
|
|
53
|
-
unique=True,
|
|
54
|
-
validators=[django.contrib.auth.validators.UnicodeUsernameValidator()],
|
|
55
|
-
verbose_name="username",
|
|
56
|
-
),
|
|
57
|
-
),
|
|
58
|
-
(
|
|
59
|
-
"first_name",
|
|
60
|
-
models.CharField(blank=True, max_length=150, verbose_name="first name"),
|
|
61
|
-
),
|
|
62
|
-
(
|
|
63
|
-
"last_name",
|
|
64
|
-
models.CharField(blank=True, max_length=150, verbose_name="last name"),
|
|
65
|
-
),
|
|
66
|
-
(
|
|
67
|
-
"email",
|
|
68
|
-
models.EmailField(
|
|
69
|
-
blank=True,
|
|
70
|
-
max_length=254,
|
|
71
|
-
verbose_name="email address",
|
|
72
|
-
),
|
|
73
|
-
),
|
|
74
|
-
(
|
|
75
|
-
"is_staff",
|
|
76
|
-
models.BooleanField(
|
|
77
|
-
default=False,
|
|
78
|
-
help_text=("Designates whether the user can log into this admin site."),
|
|
79
|
-
verbose_name="staff status",
|
|
80
|
-
),
|
|
81
|
-
),
|
|
82
|
-
(
|
|
83
|
-
"is_active",
|
|
84
|
-
models.BooleanField(
|
|
85
|
-
default=True,
|
|
86
|
-
help_text=(
|
|
87
|
-
"Designates whether this user should be treated "
|
|
88
|
-
"as active. Unselect this instead of deleting "
|
|
89
|
-
"accounts."
|
|
90
|
-
),
|
|
91
|
-
verbose_name="active",
|
|
92
|
-
),
|
|
93
|
-
),
|
|
94
|
-
(
|
|
95
|
-
"date_joined",
|
|
96
|
-
models.DateTimeField(
|
|
97
|
-
default=django.utils.timezone.now,
|
|
98
|
-
verbose_name="date joined",
|
|
99
|
-
),
|
|
100
|
-
),
|
|
101
|
-
(
|
|
102
|
-
"is_demo",
|
|
103
|
-
models.BooleanField(
|
|
104
|
-
default=False,
|
|
105
|
-
help_text="Whether this user is a demo user.",
|
|
106
|
-
),
|
|
107
|
-
),
|
|
108
|
-
(
|
|
109
|
-
"groups",
|
|
110
|
-
models.ManyToManyField(
|
|
111
|
-
blank=True,
|
|
112
|
-
help_text=(
|
|
113
|
-
"The groups this user belongs to. A user will "
|
|
114
|
-
"get all permissions granted to each of their "
|
|
115
|
-
"groups."
|
|
116
|
-
),
|
|
117
|
-
related_name="idp_user_set",
|
|
118
|
-
related_query_name="user",
|
|
119
|
-
to="auth.group",
|
|
120
|
-
verbose_name="groups",
|
|
121
|
-
),
|
|
122
|
-
),
|
|
123
|
-
(
|
|
124
|
-
"user_permissions",
|
|
125
|
-
models.ManyToManyField(
|
|
126
|
-
blank=True,
|
|
127
|
-
help_text="Specific permissions for this user.",
|
|
128
|
-
related_name="idp_user_set",
|
|
129
|
-
related_query_name="user",
|
|
130
|
-
to="auth.permission",
|
|
131
|
-
verbose_name="user permissions",
|
|
132
|
-
),
|
|
133
|
-
),
|
|
134
|
-
],
|
|
135
|
-
options={
|
|
136
|
-
"db_table": "idp_user_user",
|
|
137
|
-
},
|
|
138
|
-
managers=[
|
|
139
|
-
("objects", django.contrib.auth.models.UserManager()),
|
|
140
|
-
],
|
|
141
|
-
),
|
|
142
|
-
],
|
|
143
|
-
database_operations=[],
|
|
144
|
-
),
|
|
145
|
-
migrations.RunSQL(
|
|
146
|
-
sql="DROP TABLE IF EXISTS idp_user_userrole CASCADE;",
|
|
147
|
-
reverse_sql=migrations.RunSQL.noop,
|
|
148
|
-
),
|
|
149
|
-
]
|
|
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.dev44 → cardo_python_utils-0.5.dev46}/python_utils/data_structures.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/admin/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/admin/auth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/admin/views.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/api/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/api/drf.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/api/ninja.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/api/utils.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/auth/service.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/celery/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/db/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/db/routers.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/db/transaction.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/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
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/oidc_settings.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/redis/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/settings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/tenant_context.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/python_utils/django/tests/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev44 → cardo_python_utils-0.5.dev46}/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
|