trovesuite 1.0.20__tar.gz → 1.0.23__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.20/src/trovesuite.egg-info → trovesuite-1.0.23}/PKG-INFO +1 -1
- {trovesuite-1.0.20 → trovesuite-1.0.23}/pyproject.toml +2 -2
- {trovesuite-1.0.20 → trovesuite-1.0.23}/setup.py +1 -1
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/__init__.py +1 -1
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/auth/auth_service.py +73 -43
- {trovesuite-1.0.20 → trovesuite-1.0.23/src/trovesuite.egg-info}/PKG-INFO +1 -1
- {trovesuite-1.0.20 → trovesuite-1.0.23}/LICENSE +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/MANIFEST.in +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/README.md +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/requirements.txt +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/setup.cfg +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/auth/__init__.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/auth/auth_base.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/auth/auth_controller.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/auth/auth_read_dto.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/auth/auth_write_dto.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/configs/__init__.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/configs/database.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/configs/logging.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/configs/settings.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/entities/__init__.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/entities/health.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/entities/sh_response.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/notification/__init__.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/notification/notification_base.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/notification/notification_controller.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/notification/notification_read_dto.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/notification/notification_service.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/notification/notification_write_dto.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/storage/__init__.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/storage/storage_base.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/storage/storage_controller.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/storage/storage_read_dto.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/storage/storage_service.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/storage/storage_write_dto.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/utils/__init__.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/utils/helper.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/utils/templates.py +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite.egg-info/SOURCES.txt +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite.egg-info/dependency_links.txt +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite.egg-info/not-zip-safe +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite.egg-info/requires.txt +0 -0
- {trovesuite-1.0.20 → trovesuite-1.0.23}/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.23
|
|
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.23"
|
|
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.23"
|
|
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.23",
|
|
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,47 +255,78 @@ 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)}")
|
|
279
261
|
|
|
280
262
|
# GET permissions and Append to Role
|
|
281
263
|
get_user_roles_with_tenant_and_permissions = []
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
264
|
+
|
|
265
|
+
# Track system role IDs by querying cp_roles table for is_system flag (more reliable)
|
|
266
|
+
system_role_ids = set()
|
|
267
|
+
if all_roles:
|
|
268
|
+
role_ids = [r.get("role_id") for r in all_roles if r.get("role_id")]
|
|
269
|
+
if role_ids:
|
|
270
|
+
try:
|
|
271
|
+
# Check which roles are system roles by querying the roles table
|
|
272
|
+
system_roles_check = DatabaseManager.execute_query(
|
|
273
|
+
f"""SELECT id FROM {db_settings.CORE_PLATFORM_ROLES_TABLE}
|
|
274
|
+
WHERE id = ANY(%s) AND is_system = true AND delete_status = 'NOT_DELETED'""",
|
|
275
|
+
params=(role_ids,),
|
|
276
|
+
)
|
|
277
|
+
if system_roles_check:
|
|
278
|
+
for role_record in system_roles_check:
|
|
279
|
+
role_id = role_record.get("id") if isinstance(role_record, dict) else (role_record[0] if isinstance(role_record, (list, tuple)) and len(role_record) > 0 else None)
|
|
280
|
+
if role_id:
|
|
281
|
+
system_role_ids.add(role_id)
|
|
282
|
+
|
|
283
|
+
logger.info(f"Identified {len(system_role_ids)} system roles for user {user_id}")
|
|
284
|
+
except Exception as e:
|
|
285
|
+
logger.warning(f"Error checking system roles: {str(e)}")
|
|
286
|
+
# Fallback: use system_roles query results
|
|
287
|
+
system_role_ids = {r.get("role_id") for r in system_roles if r.get("role_id")} if system_roles else set()
|
|
286
288
|
|
|
287
289
|
for role in all_roles:
|
|
288
|
-
role_id = role
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
role_id = role.get("role_id")
|
|
291
|
+
if not role_id:
|
|
292
|
+
logger.warning(f"Skipping role with missing role_id: {role}")
|
|
293
|
+
continue
|
|
294
|
+
|
|
295
|
+
# Determine which tenant_id to use for querying permissions
|
|
296
|
+
# For system roles, use 'system-tenant-id'; for tenant roles, use the user's tenant_id
|
|
297
|
+
is_system_role = role_id in system_role_ids
|
|
298
|
+
|
|
299
|
+
# Try the primary tenant_id first based on whether it's a system role
|
|
300
|
+
if is_system_role:
|
|
301
|
+
primary_tenant_id = 'system-tenant-id'
|
|
302
|
+
fallback_tenant_id = tenant_id
|
|
292
303
|
else:
|
|
293
|
-
|
|
304
|
+
primary_tenant_id = tenant_id
|
|
305
|
+
fallback_tenant_id = 'system-tenant-id'
|
|
294
306
|
|
|
295
|
-
permissions
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
307
|
+
# Query permissions for this role with primary tenant_id
|
|
308
|
+
permissions = []
|
|
309
|
+
try:
|
|
310
|
+
permissions = DatabaseManager.execute_query(
|
|
311
|
+
f"""SELECT permission_id FROM {db_settings.CORE_PLATFORM_ROLE_PERMISSIONS_TABLE}
|
|
312
|
+
WHERE role_id = %s AND tenant_id = %s AND delete_status = 'NOT_DELETED'""",
|
|
313
|
+
params=(role_id, primary_tenant_id),
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
# If no permissions found with primary tenant_id, try fallback (handles edge cases)
|
|
317
|
+
if not permissions or len(permissions) == 0:
|
|
318
|
+
logger.debug(f"No permissions found for role {role_id} with tenant {primary_tenant_id}, trying fallback {fallback_tenant_id}")
|
|
319
|
+
fallback_permissions = DatabaseManager.execute_query(
|
|
320
|
+
f"""SELECT permission_id FROM {db_settings.CORE_PLATFORM_ROLE_PERMISSIONS_TABLE}
|
|
321
|
+
WHERE role_id = %s AND tenant_id = %s AND delete_status = 'NOT_DELETED'""",
|
|
322
|
+
params=(role_id, fallback_tenant_id),
|
|
323
|
+
)
|
|
324
|
+
if fallback_permissions and len(fallback_permissions) > 0:
|
|
325
|
+
permissions = fallback_permissions
|
|
326
|
+
logger.info(f"Found permissions for role {role_id} in fallback tenant {fallback_tenant_id}")
|
|
327
|
+
except Exception as e:
|
|
328
|
+
logger.error(f"Error querying permissions for role {role_id}: {str(e)}", exc_info=True)
|
|
329
|
+
permissions = []
|
|
300
330
|
|
|
301
331
|
role_dict = {**role, "tenant_id": tenant_id, "permissions": [p['permission_id'] for p in permissions]}
|
|
302
332
|
get_user_roles_with_tenant_and_permissions.append(role_dict)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trovesuite
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.23
|
|
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.20 → trovesuite-1.0.23}/src/trovesuite/notification/notification_controller.py
RENAMED
|
File without changes
|
{trovesuite-1.0.20 → trovesuite-1.0.23}/src/trovesuite/notification/notification_read_dto.py
RENAMED
|
File without changes
|
|
File without changes
|
{trovesuite-1.0.20 → trovesuite-1.0.23}/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
|
|
File without changes
|