trovesuite 1.0.22__tar.gz → 1.0.24__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.22/src/trovesuite.egg-info → trovesuite-1.0.24}/PKG-INFO +1 -1
- {trovesuite-1.0.22 → trovesuite-1.0.24}/pyproject.toml +2 -2
- {trovesuite-1.0.22 → trovesuite-1.0.24}/setup.py +1 -1
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/auth/auth_service.py +12 -32
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/configs/settings.py +1 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/utils/helper.py +10 -11
- {trovesuite-1.0.22 → trovesuite-1.0.24/src/trovesuite.egg-info}/PKG-INFO +1 -1
- {trovesuite-1.0.22 → trovesuite-1.0.24}/LICENSE +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/MANIFEST.in +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/README.md +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/requirements.txt +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/setup.cfg +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/__init__.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/auth/__init__.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/auth/auth_base.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/auth/auth_controller.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/auth/auth_read_dto.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/auth/auth_write_dto.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/configs/__init__.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/configs/database.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/configs/logging.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/entities/__init__.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/entities/health.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/entities/sh_response.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/notification/__init__.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/notification/notification_base.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/notification/notification_controller.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/notification/notification_read_dto.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/notification/notification_service.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/notification/notification_write_dto.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/storage/__init__.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/storage/storage_base.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/storage/storage_controller.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/storage/storage_read_dto.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/storage/storage_service.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/storage/storage_write_dto.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/utils/__init__.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/utils/templates.py +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite.egg-info/SOURCES.txt +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite.egg-info/dependency_links.txt +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite.egg-info/not-zip-safe +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite.egg-info/requires.txt +0 -0
- {trovesuite-1.0.22 → trovesuite-1.0.24}/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.24
|
|
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.24"
|
|
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.24"
|
|
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.24",
|
|
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",
|
|
@@ -229,26 +229,25 @@ class AuthService:
|
|
|
229
229
|
(tenant_id, user_id,),
|
|
230
230
|
)
|
|
231
231
|
|
|
232
|
-
# ✅ NEW: Get system-level roles from
|
|
232
|
+
# ✅ NEW: Get system-level roles from cp_assign_roles with is_system=true
|
|
233
233
|
# NOTE: system_groups, system_user_groups, and system_assign_roles are now consolidated
|
|
234
234
|
# into cp_groups, cp_user_groups, and cp_assign_roles with is_system flag
|
|
235
|
+
# Use LEFT JOIN starting from cp_assign_roles to find BOTH direct user assignments AND group-based assignments
|
|
235
236
|
logger.info(f"Fetching system-level roles for user: {user_id}")
|
|
236
237
|
|
|
237
238
|
system_roles = DatabaseManager.execute_query(
|
|
238
239
|
f"""
|
|
239
|
-
SELECT DISTINCT
|
|
240
|
-
FROM {db_settings.
|
|
241
|
-
|
|
242
|
-
ON
|
|
243
|
-
WHERE
|
|
244
|
-
AND sug.is_system = true
|
|
245
|
-
AND sug.is_active = true
|
|
246
|
-
AND sug.delete_status = 'NOT_DELETED'
|
|
247
|
-
AND sar.is_active = true
|
|
248
|
-
AND sar.delete_status = 'NOT_DELETED'
|
|
240
|
+
SELECT DISTINCT COALESCE(sar.group_id::TEXT, NULL) as group_id, sar.user_id, sar.role_id, sar.resource_type
|
|
241
|
+
FROM {db_settings.CORE_PLATFORM_ASSIGN_ROLES_TABLE} sar
|
|
242
|
+
LEFT JOIN {db_settings.CORE_PLATFORM_USER_GROUPS_TABLE} sug
|
|
243
|
+
ON sar.group_id = sug.group_id AND sar.tenant_id = sug.tenant_id
|
|
244
|
+
WHERE sar.tenant_id = 'system-tenant-id'
|
|
249
245
|
AND sar.is_system = true
|
|
246
|
+
AND sar.delete_status = 'NOT_DELETED'
|
|
247
|
+
AND sar.is_active = true
|
|
248
|
+
AND (sar.user_id = %s OR (sug.user_id = %s AND sug.tenant_id = 'system-tenant-id' AND sug.is_system = true AND sug.is_active = true AND sug.delete_status = 'NOT_DELETED'))
|
|
250
249
|
""",
|
|
251
|
-
(user_id,
|
|
250
|
+
(user_id, user_id)
|
|
252
251
|
)
|
|
253
252
|
|
|
254
253
|
if system_roles:
|
|
@@ -256,23 +255,6 @@ class AuthService:
|
|
|
256
255
|
else:
|
|
257
256
|
logger.info(f"No system-level roles found for user: {user_id}")
|
|
258
257
|
|
|
259
|
-
# ✅ NEW: Also check for direct system role assignments (user_id in cp_assign_roles with is_system=true)
|
|
260
|
-
direct_system_roles = DatabaseManager.execute_query(
|
|
261
|
-
f"""
|
|
262
|
-
SELECT DISTINCT NULL as group_id, sar.user_id, sar.role_id, sar.resource_type
|
|
263
|
-
FROM {db_settings.CORE_PLATFORM_ASSIGN_ROLES_TABLE} sar
|
|
264
|
-
WHERE sar.user_id = %s AND sar.tenant_id = %s
|
|
265
|
-
AND sar.is_active = true
|
|
266
|
-
AND sar.delete_status = 'NOT_DELETED'
|
|
267
|
-
AND sar.is_system = true
|
|
268
|
-
""",
|
|
269
|
-
(user_id, 'system-tenant-id')
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
if direct_system_roles:
|
|
273
|
-
logger.info(f"Found {len(direct_system_roles)} direct system-level role assignment(s) for user: {user_id}")
|
|
274
|
-
system_roles.extend(direct_system_roles)
|
|
275
|
-
|
|
276
258
|
# ✅ NEW: Merge tenant-level and system-level roles
|
|
277
259
|
all_roles = get_user_roles + system_roles
|
|
278
260
|
logger.info(f"Total roles (tenant + system) for user {user_id}: {len(all_roles)}")
|
|
@@ -302,9 +284,7 @@ class AuthService:
|
|
|
302
284
|
except Exception as e:
|
|
303
285
|
logger.warning(f"Error checking system roles: {str(e)}")
|
|
304
286
|
# Fallback: use system_roles query results
|
|
305
|
-
system_role_ids = {r
|
|
306
|
-
if direct_system_roles:
|
|
307
|
-
system_role_ids.update({r["role_id"] for r in direct_system_roles})
|
|
287
|
+
system_role_ids = {r.get("role_id") for r in system_roles if r.get("role_id")} if system_roles else set()
|
|
308
288
|
|
|
309
289
|
for role in all_roles:
|
|
310
290
|
role_id = role.get("role_id")
|
|
@@ -81,6 +81,7 @@ class Settings:
|
|
|
81
81
|
CORE_PLATFORM_ASSIGN_LOCATIONS_TABLE = os.getenv("CORE_PLATFORM_ASSIGN_LOCATIONS_TABLE", "core_platform.cp_assign_locations")
|
|
82
82
|
CORE_PLATFORM_UNIT_OF_MEASURE_TABLE = os.getenv("CORE_PLATFORM_UNIT_OF_MEASURE_TABLE", "core_platform.cp_unit_of_measures")
|
|
83
83
|
CORE_PLATFORM_CURRENCY = os.getenv("CORE_PLATFORM_CURRENCY", "core_platform.cp_currencies")
|
|
84
|
+
CORE_PLATFORM_THEMES_TABLE = os.getenv("CORE_PLATFORM_THEMES_TABLE", "core_platform.cp_themes")
|
|
84
85
|
|
|
85
86
|
# Mail Configurations
|
|
86
87
|
MAIL_SENDER_EMAIL=os.getenv("MAIL_SENDER_EMAIL")
|
|
@@ -97,8 +97,7 @@ class Helper:
|
|
|
97
97
|
try:
|
|
98
98
|
if tenant_id:
|
|
99
99
|
# For tenant-specific resource IDs, check shared schema with tenant_id filter
|
|
100
|
-
|
|
101
|
-
tenant_resource_table = getattr(db_settings, 'TENANT_RESOURCE_ID_TABLE', None)
|
|
100
|
+
tenant_resource_table = getattr(db_settings, 'CORE_PLATFORM_TENANT_RESOURCE_ID_TABLE', None) or getattr(db_settings, 'CORE_PLATFORM_RESOURCE_ID_TABLE', None)
|
|
102
101
|
if tenant_resource_table:
|
|
103
102
|
resource_exists = DatabaseManager.execute_scalar(
|
|
104
103
|
f"""SELECT COUNT(1) FROM {tenant_resource_table}
|
|
@@ -110,7 +109,7 @@ class Helper:
|
|
|
110
109
|
resource_exists = 0
|
|
111
110
|
else:
|
|
112
111
|
# For main schema resource IDs
|
|
113
|
-
main_resource_table = getattr(db_settings, '
|
|
112
|
+
main_resource_table = getattr(db_settings, 'CORE_PLATFORM_RESOURCE_ID_TABLE', None)
|
|
114
113
|
if main_resource_table:
|
|
115
114
|
resource_exists = DatabaseManager.execute_scalar(
|
|
116
115
|
f"""SELECT COUNT(1) FROM {main_resource_table}
|
|
@@ -236,9 +235,9 @@ class Helper:
|
|
|
236
235
|
|
|
237
236
|
try:
|
|
238
237
|
# Check if table name is set
|
|
239
|
-
tenant_activity_logs_table = getattr(db_settings, '
|
|
238
|
+
tenant_activity_logs_table = getattr(db_settings, 'CORE_PLATFORM_ACTIVITY_LOGS_TABLE', None)
|
|
240
239
|
if not tenant_activity_logs_table:
|
|
241
|
-
logger.error("
|
|
240
|
+
logger.error("CORE_PLATFORM_ACTIVITY_LOGS_TABLE is not configured in settings")
|
|
242
241
|
return
|
|
243
242
|
|
|
244
243
|
log_id = Helper.generate_unique_identifier(prefix="alog")
|
|
@@ -263,7 +262,7 @@ class Helper:
|
|
|
263
262
|
if user_id:
|
|
264
263
|
try:
|
|
265
264
|
logger.debug(f"Fetching user information for user_id={user_id}")
|
|
266
|
-
main_users_table = getattr(db_settings, '
|
|
265
|
+
main_users_table = getattr(db_settings, 'CORE_PLATFORM_USERS_TABLE', 'core_platform.cp_users')
|
|
267
266
|
user_data = DatabaseManager.execute_query(
|
|
268
267
|
f"""SELECT email, contact, fullname
|
|
269
268
|
FROM {main_users_table}
|
|
@@ -414,10 +413,10 @@ class Helper:
|
|
|
414
413
|
"""
|
|
415
414
|
try:
|
|
416
415
|
# Get table names from settings with fallbacks
|
|
417
|
-
main_users_table = getattr(db_settings, '
|
|
418
|
-
main_roles_table = getattr(db_settings, '
|
|
419
|
-
tenant_assign_roles_table = getattr(db_settings, '
|
|
420
|
-
tenant_user_groups_table = getattr(db_settings, '
|
|
416
|
+
main_users_table = getattr(db_settings, 'CORE_PLATFORM_USERS_TABLE', 'core_platform.cp_users')
|
|
417
|
+
main_roles_table = getattr(db_settings, 'CORE_PLATFORM_ROLES_TABLE', 'core_platform.cp_roles')
|
|
418
|
+
tenant_assign_roles_table = getattr(db_settings, 'CORE_PLATFORM_ASSIGN_ROLES_TABLE', 'core_platform.cp_assign_roles')
|
|
419
|
+
tenant_user_groups_table = getattr(db_settings, 'CORE_PLATFORM_USER_GROUPS_TABLE', 'core_platform.cp_user_groups')
|
|
421
420
|
|
|
422
421
|
# Query to get users with admin roles - both direct and through groups
|
|
423
422
|
query = f"""
|
|
@@ -568,7 +567,7 @@ class Helper:
|
|
|
568
567
|
actor_email = "no-reply@trovesuite.com"
|
|
569
568
|
|
|
570
569
|
if actor_user_id:
|
|
571
|
-
main_users_table = getattr(db_settings, '
|
|
570
|
+
main_users_table = getattr(db_settings, 'CORE_PLATFORM_USERS_TABLE', 'core_platform.cp_users')
|
|
572
571
|
actor_details = DatabaseManager.execute_query(
|
|
573
572
|
f"""SELECT fullname, email
|
|
574
573
|
FROM {main_users_table}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trovesuite
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.24
|
|
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
|
|
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
|
{trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/notification/notification_controller.py
RENAMED
|
File without changes
|
{trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/notification/notification_read_dto.py
RENAMED
|
File without changes
|
|
File without changes
|
{trovesuite-1.0.22 → trovesuite-1.0.24}/src/trovesuite/notification/notification_write_dto.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
|