cardo-python-utils 0.5.dev53__tar.gz → 0.5.dev55__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.dev53/cardo_python_utils.egg-info → cardo_python_utils-0.5.dev55}/PKG-INFO +1 -1
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55/cardo_python_utils.egg-info}/PKG-INFO +1 -1
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/pyproject.toml +1 -1
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/README.md +0 -2
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/auth/service.py +2 -2
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/middleware/tenant_aware_http_middleware.py +5 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/oidc_settings.py +8 -2
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/esma_choices.py +21 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/LICENSE +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/MANIFEST.in +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/README.rst +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/cardo_python_utils.egg-info/SOURCES.txt +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/cardo_python_utils.egg-info/dependency_links.txt +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/cardo_python_utils.egg-info/requires.txt +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/cardo_python_utils.egg-info/top_level.txt +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/choices.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/data_structures.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/db.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/admin/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/admin/auth.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/admin/templates/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/admin/templates/user_groups_changelist.html +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/admin/user_group.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/admin/views.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/api/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/api/drf.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/api/ninja.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/api/utils.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/apps.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/celery/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/celery/tenant_aware_database_scheduler.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/celery/tenant_aware_task.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/db/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/db/alias.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/db/routers.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/db/transaction.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/db/utils.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/management/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/management/commands/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/management/commands/migrateall.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/management/commands/shell.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/management/commands/showmigrations.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/management/commands/tenant_aware_command.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/middleware/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/middleware/tenant_aware_websocket_middleware.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/migrations/0001_initial.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/migrations/0001_initial_squashed_0005_alter_userrole_id.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/migrations/0002_auto_20220120_1617.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/migrations/0003_auto_20220513_1025.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/migrations/0004_auto_20220817_1526.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/migrations/0005_alter_userrole_id.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/migrations/0006_userrole_organization_and_more.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/migrations/0007_user_demo.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/migrations/0008_delete_userrole.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/migrations/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/models/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/models/user.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/models/user_group.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/redis/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/redis/key_function.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/settings.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/storage/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/storage/tenant_aware_storage.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/tenant_context.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/tests/__init__.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/tests/conftest.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django_utils.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/exceptions.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/imports.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/math.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/text.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/time.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/types_hinting.py +0 -0
- {cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/setup.cfg +0 -0
|
@@ -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.dev55"
|
|
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"
|
|
@@ -10,8 +10,6 @@ This package provides utilities for facilitating IDP communication and multi-ten
|
|
|
10
10
|
- DATABASE_CONFIG
|
|
11
11
|
- A JSON dictionary where each key is the tenant name and the value is a dict with the datase config.
|
|
12
12
|
- If multiple 'DATABASE_CONFIG'-prefixed variables are set, they will be merged into a single dictionary.
|
|
13
|
-
- KEYCLOAK_SERVER_URL
|
|
14
|
-
- The URL of the Keycloak deployment
|
|
15
13
|
- KEYCLOAK_CONFIDENTIAL_CLIENT_ID
|
|
16
14
|
- The id of the confidential client of the backend service
|
|
17
15
|
- KEYCLOAK_CONFIDENTIAL_CLIENT_SERVICE_ACCOUNT_TOKEN_FILE_PATHS
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/auth/service.py
RENAMED
|
@@ -6,8 +6,8 @@ from keycloak import KeycloakOpenIDConnection
|
|
|
6
6
|
from keycloak.exceptions import KeycloakGetError
|
|
7
7
|
|
|
8
8
|
from ..oidc_settings import (
|
|
9
|
-
KEYCLOAK_SERVER_URL,
|
|
10
9
|
KEYCLOAK_CONFIDENTIAL_CLIENT_ID,
|
|
10
|
+
get_keycloak_server_url,
|
|
11
11
|
get_oidc_confidential_client_token,
|
|
12
12
|
)
|
|
13
13
|
from ..tenant_context import TenantContext
|
|
@@ -70,7 +70,7 @@ class KeycloakService:
|
|
|
70
70
|
tenant = TenantContext.get()
|
|
71
71
|
|
|
72
72
|
keycloak_connection = KeycloakOpenIDConnection(
|
|
73
|
-
server_url=
|
|
73
|
+
server_url=get_keycloak_server_url(),
|
|
74
74
|
realm_name=tenant,
|
|
75
75
|
user_realm_name=tenant,
|
|
76
76
|
client_id=KEYCLOAK_CONFIDENTIAL_CLIENT_ID,
|
|
@@ -10,6 +10,8 @@ from ..tenant_context import TenantContext
|
|
|
10
10
|
|
|
11
11
|
logger = logging.getLogger(__name__)
|
|
12
12
|
|
|
13
|
+
DEFAULT_EXCLUDED_PATHS = ["/", "/healthz", "/healthz/"]
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
class TenantAwareHttpMiddleware:
|
|
15
17
|
"""
|
|
@@ -72,6 +74,9 @@ class TenantAwareHttpMiddleware:
|
|
|
72
74
|
"""
|
|
73
75
|
Check if the path should be excluded from tenant handling.
|
|
74
76
|
"""
|
|
77
|
+
if path in DEFAULT_EXCLUDED_PATHS:
|
|
78
|
+
return True
|
|
79
|
+
|
|
75
80
|
for excluded_path in TENANT_AWARE_EXCLUDED_PATHS:
|
|
76
81
|
if path.startswith(excluded_path):
|
|
77
82
|
return True
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/oidc_settings.py
RENAMED
|
@@ -12,7 +12,7 @@ from django.conf import settings
|
|
|
12
12
|
from .tenant_context import TenantContext
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
KEYCLOAK_SERVER_URL_TEMPLATE = os.getenv("KEYCLOAK_SERVER_URL_TEMPLATE", "https://keycloak.{realm}.company.com")
|
|
16
16
|
KEYCLOAK_CONFIDENTIAL_CLIENT_ID = os.getenv("KEYCLOAK_CONFIDENTIAL_CLIENT_ID", None)
|
|
17
17
|
|
|
18
18
|
OIDC_CLIENT_AUTH_METHOD = getattr(settings, "OIDC_CLIENT_AUTH_METHOD", "client_assertion")
|
|
@@ -45,11 +45,17 @@ def get_realm_for_tenant(tenant: str) -> str:
|
|
|
45
45
|
return TENANT_REALM_MAPPING.get(tenant, tenant)
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
def get_keycloak_server_url() -> str:
|
|
49
|
+
"""Get the Keycloak server URL for the current tenant."""
|
|
50
|
+
|
|
51
|
+
return KEYCLOAK_SERVER_URL_TEMPLATE.format(realm=get_realm_for_tenant(TenantContext.get()))
|
|
52
|
+
|
|
53
|
+
|
|
48
54
|
def get_oidc_op_base_url() -> str:
|
|
49
55
|
"""Get the base URL for the OIDC provider (Keycloak realm URL)."""
|
|
50
56
|
|
|
51
57
|
realm = get_realm_for_tenant(TenantContext.get())
|
|
52
|
-
return f"{
|
|
58
|
+
return f"{get_keycloak_server_url()}/realms/{realm}"
|
|
53
59
|
|
|
54
60
|
|
|
55
61
|
def get_oidc_op_authorization_endpoint() -> str:
|
|
@@ -42,6 +42,9 @@ class FinancialCreditAssetFinancingPurposeChoices(ChoiceEnum):
|
|
|
42
42
|
OTHV = 16, "Other Vehicle"
|
|
43
43
|
EQUP = 17, "Equipment"
|
|
44
44
|
PROP = 18, "Property"
|
|
45
|
+
PURC = 20, "Purchase"
|
|
46
|
+
RFTM = 21, "Rate/Term Refinance"
|
|
47
|
+
COUT = 22, "Cash-Out Refinance"
|
|
45
48
|
OTHR = 100, "Other"
|
|
46
49
|
|
|
47
50
|
|
|
@@ -60,6 +63,9 @@ class InterestRateTypeChoices(ChoiceEnum):
|
|
|
60
63
|
MODE = 12, "Modular"
|
|
61
64
|
OTHR = 13, "Other"
|
|
62
65
|
FXRT = 14, "Fixed Rate"
|
|
66
|
+
VARI = 15, "Variable (ARM)"
|
|
67
|
+
HYBR = 16, "Hybrid ARM (Fixed-to-Variable)"
|
|
68
|
+
STEP = 17, "Step Rate"
|
|
63
69
|
|
|
64
70
|
|
|
65
71
|
class SeniorityChoices(ChoiceEnum):
|
|
@@ -86,7 +92,13 @@ class EmploymentStatusChoices(ChoiceEnum):
|
|
|
86
92
|
STNT = 6, "Student"
|
|
87
93
|
PNNR = 7, "Pensioner"
|
|
88
94
|
NOEM = 8, "No Employment, Obligor is Legal Entity"
|
|
95
|
+
RETI = 9, "Retired"
|
|
89
96
|
OTHR = 10, "Other"
|
|
97
|
+
UNUM = 11, "Unemployed"
|
|
98
|
+
PATE = 12, "Part-Time Employed"
|
|
99
|
+
CNTR = 13, "Contract / Freelance"
|
|
100
|
+
BOWN = 14, "Business Owner"
|
|
101
|
+
SEAS = 15, "Seasonally Employed"
|
|
90
102
|
|
|
91
103
|
|
|
92
104
|
class PrimaryIncomeTypeChoices(ChoiceEnum):
|
|
@@ -100,6 +112,15 @@ class PrimaryIncomeTypeChoices(ChoiceEnum):
|
|
|
100
112
|
DSPL = 8, "Disposable Income"
|
|
101
113
|
CORP = 9, "Borrower is legal entity"
|
|
102
114
|
OTHR = 10, "Other"
|
|
115
|
+
SALR = 11, "Salary"
|
|
116
|
+
SEMP = 12, "Self-Employment Income"
|
|
117
|
+
BUSI = 13, "Business Income"
|
|
118
|
+
RENT = 14, "Rental Income"
|
|
119
|
+
INVT = 15, "Investment Income"
|
|
120
|
+
CNTR = 16, "1099 / Contract Income"
|
|
121
|
+
PENS = 17, "Pension / Retirement"
|
|
122
|
+
SOCS = 18, "Social Security / Disability"
|
|
123
|
+
ROYA = 19, "Royalties"
|
|
103
124
|
|
|
104
125
|
|
|
105
126
|
class PrimaryIncomeVerificationChoices(ChoiceEnum):
|
|
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.dev53 → cardo_python_utils-0.5.dev55}/python_utils/data_structures.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/admin/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/admin/auth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/admin/views.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/api/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/api/drf.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/api/ninja.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/api/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/celery/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/db/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/db/alias.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/db/routers.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/db/transaction.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/models/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/models/user.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/redis/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/settings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/tenant_context.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/python_utils/django/tests/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.dev53 → cardo_python_utils-0.5.dev55}/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
|