trovesuite 1.0.14__tar.gz → 1.0.17__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.
- {trovesuite-1.0.14/src/trovesuite.egg-info → trovesuite-1.0.17}/PKG-INFO +1 -1
- {trovesuite-1.0.14 → trovesuite-1.0.17}/pyproject.toml +2 -2
- {trovesuite-1.0.14 → trovesuite-1.0.17}/setup.py +1 -1
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/__init__.py +5 -3
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/auth/auth_service.py +5 -5
- trovesuite-1.0.17/src/trovesuite/configs/settings.py +98 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/utils/__init__.py +3 -1
- trovesuite-1.0.17/src/trovesuite/utils/helper.py +653 -0
- trovesuite-1.0.17/src/trovesuite/utils/templates.py +487 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17/src/trovesuite.egg-info}/PKG-INFO +1 -1
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite.egg-info/SOURCES.txt +2 -1
- trovesuite-1.0.14/src/trovesuite/configs/settings.py +0 -57
- trovesuite-1.0.14/src/trovesuite/utils/helper.py +0 -36
- {trovesuite-1.0.14 → trovesuite-1.0.17}/LICENSE +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/MANIFEST.in +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/README.md +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/requirements.txt +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/setup.cfg +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/auth/__init__.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/auth/auth_base.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/auth/auth_controller.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/auth/auth_read_dto.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/auth/auth_write_dto.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/configs/__init__.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/configs/database.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/configs/logging.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/entities/__init__.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/entities/health.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/entities/sh_response.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/notification/__init__.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/notification/notification_base.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/notification/notification_controller.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/notification/notification_read_dto.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/notification/notification_service.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/notification/notification_write_dto.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/storage/__init__.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/storage/storage_base.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/storage/storage_controller.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/storage/storage_read_dto.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/storage/storage_service.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite/storage/storage_write_dto.py +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite.egg-info/dependency_links.txt +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite.egg-info/not-zip-safe +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite.egg-info/requires.txt +0 -0
- {trovesuite-1.0.14 → trovesuite-1.0.17}/src/trovesuite.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trovesuite
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.17
|
|
4
4
|
Summary: TroveSuite services package providing authentication, authorization, notifications, Azure Storage, and other enterprise services for TroveSuite applications
|
|
5
5
|
Home-page: https://dev.azure.com/brightgclt/trovesuite/_git/packages
|
|
6
6
|
Author: Bright Debrah Owusu
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "trovesuite"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.17"
|
|
8
8
|
description = "TroveSuite services package providing authentication, authorization, notifications, Azure Storage, and other enterprise services for TroveSuite applications"
|
|
9
9
|
authors = ["brightgclt <brightgclt@gmail.com>"]
|
|
10
10
|
license = "MIT"
|
|
@@ -58,7 +58,7 @@ Documentation = "https://dev.azure.com/brightgclt/trovesuite/_git/packages"
|
|
|
58
58
|
|
|
59
59
|
[project]
|
|
60
60
|
name = "trovesuite"
|
|
61
|
-
version = "1.0.
|
|
61
|
+
version = "1.0.17"
|
|
62
62
|
description = "TroveSuite services package providing authentication, authorization, notifications, Azure Storage, and other enterprise services for TroveSuite applications"
|
|
63
63
|
readme = "README.md"
|
|
64
64
|
license = {text = "MIT"}
|
|
@@ -15,7 +15,7 @@ with open("pyproject.toml", "r", encoding="utf-8") as fh:
|
|
|
15
15
|
|
|
16
16
|
setup(
|
|
17
17
|
name="trovesuite",
|
|
18
|
-
version="1.0.
|
|
18
|
+
version="1.0.17",
|
|
19
19
|
author="Bright Debrah Owusu",
|
|
20
20
|
author_email="owusu.debrah@deladetech.com",
|
|
21
21
|
description="TroveSuite services package providing authentication, authorization, notifications, and other enterprise services for TroveSuite applications",
|
|
@@ -3,19 +3,21 @@ TroveSuite Package
|
|
|
3
3
|
|
|
4
4
|
A comprehensive authentication, authorization, notification, and storage service for ERP systems.
|
|
5
5
|
Provides JWT token validation, user authorization, permission checking, notification capabilities,
|
|
6
|
-
|
|
6
|
+
Azure Storage blob management, and utility functions for multi-tenant applications.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
from .auth import AuthService
|
|
10
10
|
from .notification import NotificationService
|
|
11
11
|
from .storage import StorageService
|
|
12
|
+
from .utils import Helper
|
|
12
13
|
|
|
13
|
-
__version__ = "1.0.
|
|
14
|
+
__version__ = "1.0.16"
|
|
14
15
|
__author__ = "Bright Debrah Owusu"
|
|
15
16
|
__email__ = "owusu.debrah@deladetech.com"
|
|
16
17
|
|
|
17
18
|
__all__ = [
|
|
18
19
|
"AuthService",
|
|
19
20
|
"NotificationService",
|
|
20
|
-
"StorageService"
|
|
21
|
+
"StorageService",
|
|
22
|
+
"Helper",
|
|
21
23
|
]
|
|
@@ -229,10 +229,10 @@ class AuthService:
|
|
|
229
229
|
logger.info(f"Fetching system-level roles for user: {user_id}")
|
|
230
230
|
|
|
231
231
|
system_roles = DatabaseManager.execute_query(
|
|
232
|
-
"""
|
|
232
|
+
f"""
|
|
233
233
|
SELECT DISTINCT sug.group_id, sug.user_id, sar.role_id, sar.resource_type
|
|
234
|
-
FROM
|
|
235
|
-
INNER JOIN
|
|
234
|
+
FROM {db_settings.MAIN_SYSTEM_USER_GROUPS_TABLE} sug
|
|
235
|
+
INNER JOIN {db_settings.MAIN_SYSTEM_ASSIGN_ROLES_TABLE} sar ON sug.group_id = sar.group_id
|
|
236
236
|
WHERE sug.user_id = %s
|
|
237
237
|
AND sar.is_active = true
|
|
238
238
|
AND sar.delete_status = 'NOT_DELETED'
|
|
@@ -247,9 +247,9 @@ class AuthService:
|
|
|
247
247
|
|
|
248
248
|
# ✅ NEW: Also check for direct system role assignments (user_id in system_assign_roles)
|
|
249
249
|
direct_system_roles = DatabaseManager.execute_query(
|
|
250
|
-
"""
|
|
250
|
+
f"""
|
|
251
251
|
SELECT DISTINCT NULL as group_id, sar.user_id, sar.role_id, sar.resource_type
|
|
252
|
-
FROM
|
|
252
|
+
FROM {db_settings.MAIN_SYSTEM_ASSIGN_ROLES_TABLE} sar
|
|
253
253
|
WHERE sar.user_id = %s
|
|
254
254
|
AND sar.is_active = true
|
|
255
255
|
AND sar.delete_status = 'NOT_DELETED'
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import os
|
|
2
|
+
class Settings:
|
|
3
|
+
|
|
4
|
+
# Database URL
|
|
5
|
+
DATABASE_URL: str = os.getenv("DATABASE_URL")
|
|
6
|
+
|
|
7
|
+
DB_USER: str = os.getenv("DB_USER")
|
|
8
|
+
DB_HOST: str = os.getenv("DB_HOST")
|
|
9
|
+
DB_NAME: str = os.getenv("DB_NAME")
|
|
10
|
+
DB_PORT: str = os.getenv("DB_PORT")
|
|
11
|
+
DB_PASSWORD: str = os.getenv("DB_PASSWORD")
|
|
12
|
+
|
|
13
|
+
# Application settings
|
|
14
|
+
DEBUG: bool = os.getenv("DEBUG", "True").lower() in ("true",1)
|
|
15
|
+
APP_NAME: str = os.getenv("APP_NAME", "Python Template API")
|
|
16
|
+
APP_VERSION: str = os.getenv("APP_VERSION", "1.0.0")
|
|
17
|
+
|
|
18
|
+
# Logging settings
|
|
19
|
+
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
|
|
20
|
+
LOG_FORMAT: str = os.getenv("LOG_FORMAT", "detailed") # detailed, json, simple
|
|
21
|
+
LOG_TO_FILE: bool = os.getenv("LOG_TO_FILE", "False").lower() in ("true", 1)
|
|
22
|
+
LOG_MAX_SIZE: int = int(os.getenv("LOG_MAX_SIZE", "10485760")) # 10MB
|
|
23
|
+
LOG_BACKUP_COUNT: int = int(os.getenv("LOG_BACKUP_COUNT", "5"))
|
|
24
|
+
LOG_DIR: str = os.getenv("LOG_DIR", "logs")
|
|
25
|
+
|
|
26
|
+
# Security settings
|
|
27
|
+
ALGORITHM: str = os.getenv("ALGORITHM")
|
|
28
|
+
SECRET_KEY: str = os.getenv("SECRET_KEY")
|
|
29
|
+
ENVIRONMENT: str = os.getenv("ENVIRONMENT")
|
|
30
|
+
ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "120"))
|
|
31
|
+
|
|
32
|
+
# =============================================================================
|
|
33
|
+
# SHARED TABLES (main schema)
|
|
34
|
+
# =============================================================================
|
|
35
|
+
MAIN_TENANTS_TABLE = os.getenv("MAIN_TENANTS_TABLE", "main.tenants")
|
|
36
|
+
MAIN_TENANT_RESOURCE_ID_TABLE = os.getenv("MAIN_TENANT_RESOURCE_ID_TABLE", "main.tenant_resource_ids")
|
|
37
|
+
MAIN_SUBSCRIPTIONS_TABLE = os.getenv("MAIN_SUBSCRIPTIONS_TABLE", "main.subscriptions")
|
|
38
|
+
MAIN_APPS_TABLE = os.getenv("MAIN_APPS_TABLE", "main.apps")
|
|
39
|
+
MAIN_USERS_TABLE = os.getenv("MAIN_USERS_TABLE", "main.users")
|
|
40
|
+
MAIN_RESOURCE_TYPES_TABLE = os.getenv("MAIN_RESOURCE_TYPES_TABLE", "main.resource_types")
|
|
41
|
+
MAIN_RESOURCE_ID_TABLE = os.getenv("MAIN_RESOURCE_ID_TABLE", "main.resource_ids")
|
|
42
|
+
MAIN_RESOURCES_TABLE = os.getenv("MAIN_RESOURCES_TABLE", "main.resources")
|
|
43
|
+
MAIN_PERMISSIONS_TABLE = os.getenv("MAIN_PERMISSIONS_TABLE", "main.permissions")
|
|
44
|
+
MAIN_ROLES_TABLE = os.getenv("MAIN_ROLES_TABLE", "main.roles")
|
|
45
|
+
MAIN_ROLE_PERMISSIONS_TABLE = os.getenv("MAIN_ROLE_PERMISSIONS_TABLE", "main.role_permissions")
|
|
46
|
+
MAIN_USER_SUBSCRIPTIONS_TABLE = os.getenv("MAIN_USER_SUBSCRIPTIONS_TABLE", "main.user_subscriptions")
|
|
47
|
+
MAIN_USER_SUBSCRIPTION_HISTORY_TABLE = os.getenv("MAIN_USER_SUBSCRIPTION_HISTORY_TABLE", "main.user_subscription_history")
|
|
48
|
+
MAIN_OTP = os.getenv("MAIN_OTP", "main.otps")
|
|
49
|
+
MAIN_PASSWORD_POLICY = os.getenv("MAIN_PASSWORD_POLICY", "main.password_policies")
|
|
50
|
+
MAIN_MULTI_FACTOR_SETTINGS = os.getenv("MAIN_MULTI_FACTOR_SETTINGS", "main.multi_factor_settings")
|
|
51
|
+
MAIN_USER_LOGIN_TRACKING = os.getenv("MAIN_USER_LOGIN_TRACKING", "main.user_login_tracking")
|
|
52
|
+
MAIN_ENTERPRISE_SUBSCRIPTIONS_TABLE = os.getenv("MAIN_ENTERPRISE_SUBSCRIPTIONS_TABLE", "main.enterprise_subscriptions")
|
|
53
|
+
MAIN_CHANGE_PASSWORD_POLICY_TABLE = os.getenv("MAIN_CHANGE_PASSWORD_POLICY_TABLE", "main.change_password_policy")
|
|
54
|
+
|
|
55
|
+
# System-level tables
|
|
56
|
+
MAIN_SYSTEM_GROUPS_TABLE = os.getenv("MAIN_SYSTEM_GROUPS_TABLE", "main.system_groups")
|
|
57
|
+
MAIN_SYSTEM_USER_GROUPS_TABLE = os.getenv("MAIN_SYSTEM_USER_GROUPS_TABLE", "main.system_user_groups")
|
|
58
|
+
MAIN_SYSTEM_ASSIGN_ROLES_TABLE = os.getenv("MAIN_SYSTEM_ASSIGN_ROLES_TABLE", "main.system_assign_roles")
|
|
59
|
+
|
|
60
|
+
# =============================================================================
|
|
61
|
+
# TENANT-SPECIFIC TABLES (tenant schemas)
|
|
62
|
+
# =============================================================================
|
|
63
|
+
TENANT_SUBSCRIPTIONS_TABLE = os.getenv("TENANT_SUBSCRIPTIONS_TABLE")
|
|
64
|
+
TENANT_GROUPS_TABLE = os.getenv("TENANT_GROUPS_TABLE")
|
|
65
|
+
TENANT_LOGIN_SETTINGS_TABLE = os.getenv("TENANT_LOGIN_SETTINGS_TABLE")
|
|
66
|
+
TENANT_RESOURCES_TABLE = os.getenv("TENANT_RESOURCES_TABLE")
|
|
67
|
+
TENANT_ASSIGN_ROLES_TABLE = os.getenv("TENANT_ASSIGN_ROLES_TABLE")
|
|
68
|
+
TENANT_RESOURCE_ID_TABLE = os.getenv("TENANT_RESOURCE_ID_TABLE")
|
|
69
|
+
TENANT_SUBSCRIPTION_HISTORY_TABLE = os.getenv("TENANT_SUBSCRIPTION_HISTORY_TABLE")
|
|
70
|
+
TENANT_RESOURCE_DELETION_CHAT_HISTORY_TABLE = os.getenv("TENANT_RESOURCE_DELETION_CHAT_HISTORY_TABLE")
|
|
71
|
+
TENANT_USER_GROUPS_TABLE = os.getenv("TENANT_USER_GROUPS_TABLE")
|
|
72
|
+
TENANT_ACTIVITY_LOGS_TABLE = os.getenv("TENANT_ACTIVITY_LOGS_TABLE")
|
|
73
|
+
TENANT_ORGANIZATIONS_TABLE = os.getenv("TENANT_ORGANIZATIONS_TABLE", "organizations")
|
|
74
|
+
TENANT_BUSINESSES_TABLE = os.getenv("TENANT_BUSINESSES_TABLE", "businesses")
|
|
75
|
+
TENANT_BUSINESS_APPS_TABLE = os.getenv("TENANT_BUSINESS_APPS_TABLE", "business_apps")
|
|
76
|
+
TENANT_LOCATIONS_TABLE = os.getenv("TENANT_LOCATIONS_TABLE", "locations")
|
|
77
|
+
TENANT_ASSIGN_LOCATIONS_TABLE = os.getenv("TENANT_ASSIGN_LOCATIONS_TABLE", "assign_locations")
|
|
78
|
+
TENANT_UNIT_OF_MEASURE_TABLE = os.getenv("TENANT_UNIT_OF_MEASURE_TABLE")
|
|
79
|
+
TENANT_CURRENCY=os.getenv("TENANT_CURRENCY")
|
|
80
|
+
|
|
81
|
+
# Mail Configurations
|
|
82
|
+
MAIL_SENDER_EMAIL=os.getenv("MAIL_SENDER_EMAIL")
|
|
83
|
+
MAIL_SENDER_PWD=os.getenv("MAIL_SENDER_PWD")
|
|
84
|
+
|
|
85
|
+
# Application Configurations
|
|
86
|
+
APP_URL=os.getenv("APP_URL", "https://trovesuite.com")
|
|
87
|
+
USER_ASSIGNED_MANAGED_IDENTITY=os.getenv("USER_ASSIGNED_MANAGED_IDENTITY")
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def database_url(self) -> str:
|
|
91
|
+
if self.DATABASE_URL:
|
|
92
|
+
return self.DATABASE_URL
|
|
93
|
+
|
|
94
|
+
port = int(self.DB_PORT) if self.DB_PORT else 5432
|
|
95
|
+
return f"postgresql://{self.DB_USER}:{self.DB_PASSWORD}@{self.DB_HOST}:{port}/{self.DB_NAME}"
|
|
96
|
+
|
|
97
|
+
# Global settings instance
|
|
98
|
+
db_settings = Settings()
|