trovesuite 1.0.18__py3-none-any.whl → 1.0.19__py3-none-any.whl
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/auth/auth_service.py +42 -18
- trovesuite/configs/settings.py +46 -45
- trovesuite/utils/helper.py +17 -16
- {trovesuite-1.0.18.dist-info → trovesuite-1.0.19.dist-info}/METADATA +1 -1
- {trovesuite-1.0.18.dist-info → trovesuite-1.0.19.dist-info}/RECORD +8 -8
- {trovesuite-1.0.18.dist-info → trovesuite-1.0.19.dist-info}/WHEEL +0 -0
- {trovesuite-1.0.18.dist-info → trovesuite-1.0.19.dist-info}/licenses/LICENSE +0 -0
- {trovesuite-1.0.18.dist-info → trovesuite-1.0.19.dist-info}/top_level.txt +0 -0
trovesuite/auth/auth_service.py
CHANGED
|
@@ -72,7 +72,7 @@ class AuthService:
|
|
|
72
72
|
try:
|
|
73
73
|
|
|
74
74
|
is_tenant_verified = DatabaseManager.execute_query(
|
|
75
|
-
f"SELECT is_verified FROM {db_settings.
|
|
75
|
+
f"SELECT is_verified FROM {db_settings.CORE_PLATFORM_TENANTS_TABLE} WHERE delete_status = 'NOT_DELETED' AND id = %s",
|
|
76
76
|
(tenant_id,),
|
|
77
77
|
)
|
|
78
78
|
|
|
@@ -98,8 +98,8 @@ class AuthService:
|
|
|
98
98
|
|
|
99
99
|
# 1️⃣ Get all groups the user belongs to
|
|
100
100
|
user_groups = DatabaseManager.execute_query(
|
|
101
|
-
f"""SELECT group_id FROM {db_settings.
|
|
102
|
-
WHERE tenant_id = %s AND delete_status = 'NOT_DELETED' AND is_active = true AND user_id = %s""",
|
|
101
|
+
f"""SELECT group_id FROM {db_settings.CORE_PLATFORM_USER_GROUPS_TABLE}
|
|
102
|
+
WHERE tenant_id = %s AND delete_status = 'NOT_DELETED' AND is_active = true AND user_id = %s AND (is_system = false OR is_system IS NULL)""",
|
|
103
103
|
(tenant_id, user_id,),
|
|
104
104
|
)
|
|
105
105
|
|
|
@@ -111,7 +111,7 @@ class AuthService:
|
|
|
111
111
|
login_settings_details = DatabaseManager.execute_query(
|
|
112
112
|
f"""SELECT user_id, group_id, is_suspended, can_always_login,
|
|
113
113
|
is_multi_factor_enabled, is_login_before, working_days,
|
|
114
|
-
login_on, logout_on FROM {db_settings.
|
|
114
|
+
login_on, logout_on FROM {db_settings.CORE_PLATFORM_LOGIN_SETTINGS_TABLE}
|
|
115
115
|
WHERE tenant_id = %s AND (delete_status = 'NOT_DELETED' AND is_active = true )
|
|
116
116
|
AND (user_id = %s OR group_id = ANY(%s))
|
|
117
117
|
ORDER BY user_id NULLS LAST
|
|
@@ -122,7 +122,7 @@ class AuthService:
|
|
|
122
122
|
login_settings_details = DatabaseManager.execute_query(
|
|
123
123
|
f"""SELECT user_id, group_id, is_suspended, can_always_login,
|
|
124
124
|
is_multi_factor_enabled, is_login_before, working_days,
|
|
125
|
-
login_on, logout_on FROM {db_settings.
|
|
125
|
+
login_on, logout_on FROM {db_settings.CORE_PLATFORM_LOGIN_SETTINGS_TABLE}
|
|
126
126
|
WHERE tenant_id = %s AND (delete_status = 'NOT_DELETED' AND is_active = true ) AND user_id = %s""",
|
|
127
127
|
(tenant_id, user_id,),
|
|
128
128
|
)
|
|
@@ -159,6 +159,7 @@ class AuthService:
|
|
|
159
159
|
# 2. time period restriction (if login_on/logout_on are set)
|
|
160
160
|
|
|
161
161
|
if login_on and logout_on:
|
|
162
|
+
|
|
162
163
|
# Time period restriction is active
|
|
163
164
|
logger.info(f"Checking time period restriction for user: {user_id}")
|
|
164
165
|
|
|
@@ -203,9 +204,10 @@ class AuthService:
|
|
|
203
204
|
f"""
|
|
204
205
|
SELECT DISTINCT ON (group_id, user_id, role_id)
|
|
205
206
|
group_id, user_id, role_id, resource_type
|
|
206
|
-
FROM {db_settings.
|
|
207
|
+
FROM {db_settings.CORE_PLATFORM_ASSIGN_ROLES_TABLE}
|
|
207
208
|
WHERE tenant_id = %s AND delete_status = 'NOT_DELETED'
|
|
208
209
|
AND is_active = true
|
|
210
|
+
AND (is_system = false OR is_system IS NULL)
|
|
209
211
|
AND (user_id = %s OR group_id = ANY(%s))
|
|
210
212
|
ORDER BY group_id, user_id, role_id;
|
|
211
213
|
""",
|
|
@@ -217,28 +219,36 @@ class AuthService:
|
|
|
217
219
|
f"""
|
|
218
220
|
SELECT DISTINCT ON (user_id, role_id)
|
|
219
221
|
user_id, role_id, resource_type
|
|
220
|
-
FROM {db_settings.
|
|
222
|
+
FROM {db_settings.CORE_PLATFORM_ASSIGN_ROLES_TABLE}
|
|
221
223
|
WHERE tenant_id = %s AND delete_status = 'NOT_DELETED'
|
|
222
224
|
AND is_active = true
|
|
225
|
+
AND (is_system = false OR is_system IS NULL)
|
|
223
226
|
AND user_id = %s
|
|
224
227
|
ORDER BY user_id, role_id;
|
|
225
228
|
""",
|
|
226
229
|
(tenant_id, user_id,),
|
|
227
230
|
)
|
|
228
231
|
|
|
229
|
-
# ✅ NEW: Get system-level roles from
|
|
232
|
+
# ✅ NEW: Get system-level roles from cp_user_groups and cp_assign_roles with is_system=true
|
|
233
|
+
# NOTE: system_groups, system_user_groups, and system_assign_roles are now consolidated
|
|
234
|
+
# into cp_groups, cp_user_groups, and cp_assign_roles with is_system flag
|
|
230
235
|
logger.info(f"Fetching system-level roles for user: {user_id}")
|
|
231
236
|
|
|
232
237
|
system_roles = DatabaseManager.execute_query(
|
|
233
238
|
f"""
|
|
234
239
|
SELECT DISTINCT sug.group_id, sug.user_id, sar.role_id, sar.resource_type
|
|
235
|
-
FROM {db_settings.
|
|
236
|
-
INNER JOIN {db_settings.
|
|
237
|
-
|
|
240
|
+
FROM {db_settings.CORE_PLATFORM_SYSTEM_USER_GROUPS_TABLE} sug
|
|
241
|
+
INNER JOIN {db_settings.CORE_PLATFORM_SYSTEM_ASSIGN_ROLES_TABLE} sar
|
|
242
|
+
ON sug.group_id = sar.group_id AND sug.tenant_id = sar.tenant_id
|
|
243
|
+
WHERE sug.user_id = %s AND sug.tenant_id = %s
|
|
244
|
+
AND sug.is_system = true
|
|
245
|
+
AND sug.is_active = true
|
|
246
|
+
AND sug.delete_status = 'NOT_DELETED'
|
|
238
247
|
AND sar.is_active = true
|
|
239
248
|
AND sar.delete_status = 'NOT_DELETED'
|
|
249
|
+
AND sar.is_system = true
|
|
240
250
|
""",
|
|
241
|
-
(user_id,)
|
|
251
|
+
(user_id, 'system-tenant-id')
|
|
242
252
|
)
|
|
243
253
|
|
|
244
254
|
if system_roles:
|
|
@@ -246,16 +256,17 @@ class AuthService:
|
|
|
246
256
|
else:
|
|
247
257
|
logger.info(f"No system-level roles found for user: {user_id}")
|
|
248
258
|
|
|
249
|
-
# ✅ NEW: Also check for direct system role assignments (user_id in
|
|
259
|
+
# ✅ NEW: Also check for direct system role assignments (user_id in cp_assign_roles with is_system=true)
|
|
250
260
|
direct_system_roles = DatabaseManager.execute_query(
|
|
251
261
|
f"""
|
|
252
262
|
SELECT DISTINCT NULL as group_id, sar.user_id, sar.role_id, sar.resource_type
|
|
253
|
-
FROM {db_settings.
|
|
254
|
-
WHERE sar.user_id = %s
|
|
263
|
+
FROM {db_settings.CORE_PLATFORM_SYSTEM_ASSIGN_ROLES_TABLE} sar
|
|
264
|
+
WHERE sar.user_id = %s AND sar.tenant_id = %s
|
|
255
265
|
AND sar.is_active = true
|
|
256
266
|
AND sar.delete_status = 'NOT_DELETED'
|
|
267
|
+
AND sar.is_system = true
|
|
257
268
|
""",
|
|
258
|
-
(user_id,)
|
|
269
|
+
(user_id, 'system-tenant-id')
|
|
259
270
|
)
|
|
260
271
|
|
|
261
272
|
if direct_system_roles:
|
|
@@ -268,10 +279,23 @@ class AuthService:
|
|
|
268
279
|
|
|
269
280
|
# GET permissions and Append to Role
|
|
270
281
|
get_user_roles_with_tenant_and_permissions = []
|
|
282
|
+
# Track system role IDs for quick lookup
|
|
283
|
+
system_role_ids = {r["role_id"] for r in system_roles} if system_roles else set()
|
|
284
|
+
if direct_system_roles:
|
|
285
|
+
system_role_ids.update({r["role_id"] for r in direct_system_roles})
|
|
286
|
+
|
|
271
287
|
for role in all_roles:
|
|
288
|
+
role_id = role["role_id"]
|
|
289
|
+
# For system roles, use system-tenant-id; for tenant roles, use tenant_id
|
|
290
|
+
if role_id in system_role_ids:
|
|
291
|
+
role_tenant_id = 'system-tenant-id'
|
|
292
|
+
else:
|
|
293
|
+
role_tenant_id = tenant_id
|
|
294
|
+
|
|
272
295
|
permissions = DatabaseManager.execute_query(
|
|
273
|
-
f"""SELECT permission_id FROM {db_settings.
|
|
274
|
-
|
|
296
|
+
f"""SELECT permission_id FROM {db_settings.CORE_PLATFORM_ROLE_PERMISSIONS_TABLE}
|
|
297
|
+
WHERE role_id = %s AND tenant_id = %s""",
|
|
298
|
+
params=(role_id, role_tenant_id),
|
|
275
299
|
)
|
|
276
300
|
|
|
277
301
|
role_dict = {**role, "tenant_id": tenant_id, "permissions": [p['permission_id'] for p in permissions]}
|
trovesuite/configs/settings.py
CHANGED
|
@@ -10,6 +10,11 @@ class Settings:
|
|
|
10
10
|
DB_PORT: str = os.getenv("DB_PORT")
|
|
11
11
|
DB_PASSWORD: str = os.getenv("DB_PASSWORD")
|
|
12
12
|
|
|
13
|
+
# CORS Endpoint
|
|
14
|
+
# LOCAL_HOST_URL = os.getenv("LOCAL_HOST_URL")
|
|
15
|
+
# FRONTEND_SERVER_URL_1 = os.getenv("FRONTEND_SERVER_URL")
|
|
16
|
+
# FRONTEND_SERVER_URL_2 = os.getenv("FRONTEND_SERVER_URL")
|
|
17
|
+
|
|
13
18
|
# Application settings
|
|
14
19
|
DEBUG: bool = os.getenv("DEBUG", "True").lower() in ("true",1)
|
|
15
20
|
APP_NAME: str = os.getenv("APP_NAME", "Python Template API")
|
|
@@ -30,56 +35,52 @@ class Settings:
|
|
|
30
35
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "120"))
|
|
31
36
|
|
|
32
37
|
# =============================================================================
|
|
33
|
-
# SHARED TABLES (
|
|
38
|
+
# SHARED TABLES (core_platform schema)
|
|
34
39
|
# =============================================================================
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
CORE_PLATFORM_TENANTS_TABLE = os.getenv("CORE_PLATFORM_TENANTS_TABLE", "core_platform.cp_tenants")
|
|
41
|
+
CORE_PLATFORM_TENANT_RESOURCE_ID_TABLE = os.getenv("CORE_PLATFORM_TENANT_RESOURCE_ID_TABLE", "core_platform.cp_resource_ids")
|
|
42
|
+
CORE_PLATFORM_SUBSCRIPTIONS_TABLE = os.getenv("CORE_PLATFORM_SUBSCRIPTIONS_TABLE", "core_platform.cp_subscriptions")
|
|
43
|
+
CORE_PLATFORM_APPS_TABLE = os.getenv("CORE_PLATFORM_APPS_TABLE", "core_platform.cp_apps")
|
|
44
|
+
CORE_PLATFORM_USERS_TABLE = os.getenv("CORE_PLATFORM_USERS_TABLE", "core_platform.cp_users")
|
|
45
|
+
CORE_PLATFORM_RESOURCE_TYPES_TABLE = os.getenv("CORE_PLATFORM_RESOURCE_TYPES_TABLE", "core_platform.cp_resource_types")
|
|
46
|
+
CORE_PLATFORM_RESOURCE_ID_TABLE = os.getenv("CORE_PLATFORM_RESOURCE_ID_TABLE", "core_platform.cp_shared_resource_ids")
|
|
47
|
+
CORE_PLATFORM_RESOURCES_TABLE = os.getenv("CORE_PLATFORM_RESOURCES_TABLE", "core_platform.resources")
|
|
48
|
+
CORE_PLATFORM_PERMISSIONS_TABLE = os.getenv("CORE_PLATFORM_PERMISSIONS_TABLE", "core_platform.cp_permissions")
|
|
49
|
+
CORE_PLATFORM_ROLES_TABLE = os.getenv("CORE_PLATFORM_ROLES_TABLE", "core_platform.cp_roles")
|
|
50
|
+
CORE_PLATFORM_ROLE_PERMISSIONS_TABLE = os.getenv("CORE_PLATFORM_ROLE_PERMISSIONS_TABLE", "core_platform.cp_role_permissions")
|
|
51
|
+
CORE_PLATFORM_USER_SUBSCRIPTIONS_TABLE = os.getenv("CORE_PLATFORM_USER_SUBSCRIPTIONS_TABLE", "core_platform.cp_user_subscriptions")
|
|
52
|
+
CORE_PLATFORM_USER_SUBSCRIPTION_HISTORY_TABLE = os.getenv("CORE_PLATFORM_USER_SUBSCRIPTION_HISTORY_TABLE", "core_platform.cp_user_subscription_histories")
|
|
53
|
+
CORE_PLATFORM_OTP = os.getenv("CORE_PLATFORM_OTP", "core_platform.cp_otps")
|
|
54
|
+
CORE_PLATFORM_PASSWORD_POLICY = os.getenv("CORE_PLATFORM_PASSWORD_POLICY", "core_platform.cp_password_policies")
|
|
55
|
+
CORE_PLATFORM_MULTI_FACTOR_SETTINGS = os.getenv("CORE_PLATFORM_MULTI_FACTOR_SETTINGS", "core_platform.cp_multi_factor_settings")
|
|
56
|
+
CORE_PLATFORM_USER_LOGIN_TRACKING = os.getenv("CORE_PLATFORM_USER_LOGIN_TRACKING", "core_platform.cp_user_login_tracking")
|
|
57
|
+
CORE_PLATFORM_ENTERPRISE_SUBSCRIPTIONS_TABLE = os.getenv("CORE_PLATFORM_ENTERPRISE_SUBSCRIPTIONS_TABLE", "core_platform.cp_enterprise_subscriptions")
|
|
58
|
+
CORE_PLATFORM_CHANGE_PASSWORD_POLICY_TABLE = os.getenv("CORE_PLATFORM_CHANGE_PASSWORD_POLICY_TABLE", "core_platform.cp_change_password_policy")
|
|
59
|
+
CORE_PLATFORM_APP_FEATURES_TABLE = os.getenv("CORE_PLATFORM_APP_FEATURES_TABLE", "core_platform.cp_app_features")
|
|
54
60
|
|
|
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
|
# =============================================================================
|
|
61
|
-
#
|
|
62
|
+
# CORE PLATFORM TABLES (prefixed with cp_, now in core_platform schema with tenant_id)
|
|
62
63
|
# =============================================================================
|
|
63
|
-
# NOTE: These tables have been
|
|
64
|
-
# All tables
|
|
64
|
+
# NOTE: These tables have been renamed from tenant_ prefix to cp_ (core platform).
|
|
65
|
+
# All tables include tenant_id column for multi-tenant isolation.
|
|
66
|
+
# Tables with is_system column can contain both user and system data.
|
|
65
67
|
# =============================================================================
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
TENANT_CURRENCY = os.getenv("TENANT_CURRENCY", "main.tenant_currency")
|
|
68
|
+
CORE_PLATFORM_GROUPS_TABLE = os.getenv("CORE_PLATFORM_GROUPS_TABLE", "core_platform.cp_groups")
|
|
69
|
+
CORE_PLATFORM_LOGIN_SETTINGS_TABLE = os.getenv("CORE_PLATFORM_LOGIN_SETTINGS_TABLE", "core_platform.cp_login_settings")
|
|
70
|
+
CORE_PLATFORM_RESOURCES_TABLE = os.getenv("CORE_PLATFORM_RESOURCES_TABLE", "core_platform.cp_resources")
|
|
71
|
+
CORE_PLATFORM_ASSIGN_ROLES_TABLE = os.getenv("CORE_PLATFORM_ASSIGN_ROLES_TABLE", "core_platform.cp_assign_roles")
|
|
72
|
+
CORE_PLATFORM_RESOURCE_ID_TABLE = os.getenv("CORE_PLATFORM_RESOURCE_ID_TABLE", "core_platform.cp_resource_ids")
|
|
73
|
+
CORE_PLATFORM_SUBSCRIPTION_HISTORY_TABLE = os.getenv("CORE_PLATFORM_SUBSCRIPTION_HISTORY_TABLE", "core_platform.cp_user_subscription_histories")
|
|
74
|
+
CORE_PLATFORM_RESOURCE_DELETION_CHAT_HISTORY_TABLE = os.getenv("CORE_PLATFORM_RESOURCE_DELETION_CHAT_HISTORY_TABLE", "core_platform.cp_resource_deletion_chat_histories")
|
|
75
|
+
CORE_PLATFORM_USER_GROUPS_TABLE = os.getenv("CORE_PLATFORM_USER_GROUPS_TABLE", "core_platform.cp_user_groups")
|
|
76
|
+
CORE_PLATFORM_ACTIVITY_LOGS_TABLE = os.getenv("CORE_PLATFORM_ACTIVITY_LOGS_TABLE", "core_platform.cp_activity_logs")
|
|
77
|
+
CORE_PLATFORM_ORGANIZATIONS_TABLE = os.getenv("CORE_PLATFORM_ORGANIZATIONS_TABLE", "core_platform.cp_organizations")
|
|
78
|
+
CORE_PLATFORM_BUSINESSES_TABLE = os.getenv("CORE_PLATFORM_BUSINESSES_TABLE", "core_platform.cp_businesses")
|
|
79
|
+
CORE_PLATFORM_BUSINESS_APPS_TABLE = os.getenv("CORE_PLATFORM_BUSINESS_APPS_TABLE", "core_platform.cp_business_apps")
|
|
80
|
+
CORE_PLATFORM_LOCATIONS_TABLE = os.getenv("CORE_PLATFORM_LOCATIONS_TABLE", "core_platform.cp_locations")
|
|
81
|
+
CORE_PLATFORM_ASSIGN_LOCATIONS_TABLE = os.getenv("CORE_PLATFORM_ASSIGN_LOCATIONS_TABLE", "core_platform.cp_assign_locations")
|
|
82
|
+
CORE_PLATFORM_UNIT_OF_MEASURE_TABLE = os.getenv("CORE_PLATFORM_UNIT_OF_MEASURE_TABLE", "core_platform.cp_unit_of_measures")
|
|
83
|
+
CORE_PLATFORM_CURRENCY = os.getenv("CORE_PLATFORM_CURRENCY", "core_platform.cp_currencies")
|
|
83
84
|
|
|
84
85
|
# Mail Configurations
|
|
85
86
|
MAIL_SENDER_EMAIL=os.getenv("MAIL_SENDER_EMAIL")
|
trovesuite/utils/helper.py
CHANGED
|
@@ -263,12 +263,12 @@ class Helper:
|
|
|
263
263
|
if user_id:
|
|
264
264
|
try:
|
|
265
265
|
logger.debug(f"Fetching user information for user_id={user_id}")
|
|
266
|
-
main_users_table = getattr(db_settings, 'MAIN_USERS_TABLE', 'main.
|
|
266
|
+
main_users_table = getattr(db_settings, 'MAIN_USERS_TABLE', 'main.cp_users')
|
|
267
267
|
user_data = DatabaseManager.execute_query(
|
|
268
268
|
f"""SELECT email, contact, fullname
|
|
269
269
|
FROM {main_users_table}
|
|
270
|
-
WHERE id = %s""",
|
|
271
|
-
(user_id,)
|
|
270
|
+
WHERE id = %s AND tenant_id = %s""",
|
|
271
|
+
(user_id, tenant_id)
|
|
272
272
|
)
|
|
273
273
|
logger.debug(f"User data query returned: {user_data}")
|
|
274
274
|
|
|
@@ -423,15 +423,16 @@ class Helper:
|
|
|
423
423
|
query = f"""
|
|
424
424
|
SELECT DISTINCT u.id as user_id, u.email, u.fullname
|
|
425
425
|
FROM {main_users_table} u
|
|
426
|
-
WHERE u.
|
|
426
|
+
WHERE u.tenant_id = %s
|
|
427
|
+
AND u.delete_status = 'NOT_DELETED'
|
|
427
428
|
AND u.is_active = true
|
|
428
429
|
AND u.can_login = true
|
|
429
430
|
AND (
|
|
430
431
|
-- Direct role assignment
|
|
431
|
-
u.id IN (
|
|
432
|
-
SELECT ar.user_id
|
|
432
|
+
(u.id, u.tenant_id) IN (
|
|
433
|
+
SELECT ar.user_id, ar.tenant_id
|
|
433
434
|
FROM {tenant_assign_roles_table} ar
|
|
434
|
-
INNER JOIN {main_roles_table} r ON ar.role_id = r.id
|
|
435
|
+
INNER JOIN {main_roles_table} r ON ar.role_id = r.id AND ar.tenant_id = r.tenant_id
|
|
435
436
|
WHERE ar.tenant_id = %s
|
|
436
437
|
AND ar.delete_status = 'NOT_DELETED'
|
|
437
438
|
AND ar.is_active = true
|
|
@@ -442,11 +443,11 @@ class Helper:
|
|
|
442
443
|
)
|
|
443
444
|
OR
|
|
444
445
|
-- Group-based role assignment
|
|
445
|
-
u.id IN (
|
|
446
|
-
SELECT ug.user_id
|
|
446
|
+
(u.id, u.tenant_id) IN (
|
|
447
|
+
SELECT ug.user_id, ug.tenant_id
|
|
447
448
|
FROM {tenant_user_groups_table} ug
|
|
448
|
-
INNER JOIN {tenant_assign_roles_table} ar ON ug.group_id = ar.group_id
|
|
449
|
-
INNER JOIN {main_roles_table} r ON ar.role_id = r.id
|
|
449
|
+
INNER JOIN {tenant_assign_roles_table} ar ON ug.group_id = ar.group_id AND ug.tenant_id = ar.tenant_id
|
|
450
|
+
INNER JOIN {main_roles_table} r ON ar.role_id = r.id AND ar.tenant_id = r.tenant_id
|
|
450
451
|
WHERE ug.tenant_id = %s
|
|
451
452
|
AND ar.tenant_id = %s
|
|
452
453
|
AND ug.delete_status = 'NOT_DELETED'
|
|
@@ -461,7 +462,7 @@ class Helper:
|
|
|
461
462
|
)
|
|
462
463
|
"""
|
|
463
464
|
|
|
464
|
-
results = DatabaseManager.execute_query(query, (tenant_id, tenant_id, tenant_id,))
|
|
465
|
+
results = DatabaseManager.execute_query(query, (tenant_id, tenant_id, tenant_id, tenant_id,))
|
|
465
466
|
|
|
466
467
|
admin_users = []
|
|
467
468
|
if results:
|
|
@@ -567,15 +568,15 @@ class Helper:
|
|
|
567
568
|
actor_email = "no-reply@trovesuite.com"
|
|
568
569
|
|
|
569
570
|
if actor_user_id:
|
|
570
|
-
main_users_table = getattr(db_settings, 'MAIN_USERS_TABLE', 'main.
|
|
571
|
+
main_users_table = getattr(db_settings, 'MAIN_USERS_TABLE', 'main.cp_users')
|
|
571
572
|
actor_details = DatabaseManager.execute_query(
|
|
572
573
|
f"""SELECT fullname, email
|
|
573
574
|
FROM {main_users_table}
|
|
574
|
-
WHERE id = %s""",
|
|
575
|
-
(actor_user_id,),
|
|
575
|
+
WHERE id = %s AND tenant_id = %s""",
|
|
576
|
+
(actor_user_id, tenant_id),
|
|
576
577
|
)
|
|
577
578
|
|
|
578
|
-
if actor_details:
|
|
579
|
+
if actor_details and len(actor_details) > 0:
|
|
579
580
|
actor_data = dict(actor_details[0])
|
|
580
581
|
actor_name_candidate = (actor_data.get("fullname") or "").strip()
|
|
581
582
|
actor_name = actor_name_candidate or actor_data.get("email") or actor_name
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trovesuite
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.19
|
|
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
|
|
@@ -3,12 +3,12 @@ trovesuite/auth/__init__.py,sha256=OjZllVvjul1glDazJ-d5TrNjgHFigFlQQi1G99DYshk,2
|
|
|
3
3
|
trovesuite/auth/auth_base.py,sha256=rZHQVLeJRBQ8GClgF5UwG-er4_HXVX5-nt8o6_Z29uY,75
|
|
4
4
|
trovesuite/auth/auth_controller.py,sha256=PAgaVlf5TYEfkSfK4vGGsvO84i8zEmeVVXyUF2YBppI,420
|
|
5
5
|
trovesuite/auth/auth_read_dto.py,sha256=e27JqKVPVUM83A_mYF452QCflsvGNo7aKje7q_urwFc,571
|
|
6
|
-
trovesuite/auth/auth_service.py,sha256=
|
|
6
|
+
trovesuite/auth/auth_service.py,sha256=LVFGM1e6AobQbY62nXQE_clFqC-Q0Li8fNMP6Hm_jtM,19723
|
|
7
7
|
trovesuite/auth/auth_write_dto.py,sha256=rdwI7w6-9QZGv1H0PAGrjkLBCzaMHjgPIXeLb9RmNec,234
|
|
8
8
|
trovesuite/configs/__init__.py,sha256=h1mSZOaZ3kUy1ZMO_m9O9KklsxywM0RfMVZLh9h9WvQ,328
|
|
9
9
|
trovesuite/configs/database.py,sha256=IPSu8fXjxyYeJ3bFknJG06Qm2L2ub6Ht19xhKv8g7nA,11731
|
|
10
10
|
trovesuite/configs/logging.py,sha256=mGjR2d4urVNry9l5_aXycMMtcY2RAFIpEL35hw33KZg,9308
|
|
11
|
-
trovesuite/configs/settings.py,sha256=
|
|
11
|
+
trovesuite/configs/settings.py,sha256=2S1zPHJiYWaK6xT-tnZBfT2gJ-C0O6qXMtVQt_Xtyi4,7200
|
|
12
12
|
trovesuite/entities/__init__.py,sha256=Dbl_03Bueyh2vOP2hykd40MmNMrl5nNHSRGP-kqwwNo,160
|
|
13
13
|
trovesuite/entities/health.py,sha256=KaW7yxTQdymIPlnkJJkDqEebBXkD0a7A66i5GgNZLoE,2700
|
|
14
14
|
trovesuite/entities/sh_response.py,sha256=1_sw3PpVaDxWsNiBU0W9YLHZgTFxEj4JJBLBfSY63Ho,1579
|
|
@@ -25,10 +25,10 @@ trovesuite/storage/storage_read_dto.py,sha256=o7EVJdwrwVZAaeyGU9O01WMECGVaytkvLR
|
|
|
25
25
|
trovesuite/storage/storage_service.py,sha256=V7LIePIV6b_iuhm-9x8r4zwpZHgeRPL1YIe5IBnxhco,19768
|
|
26
26
|
trovesuite/storage/storage_write_dto.py,sha256=vl1iCZ93bpFmpvkCrn587QtMtOA_TPDseXSoTuj9RTQ,1355
|
|
27
27
|
trovesuite/utils/__init__.py,sha256=mDZuY77BphvQFYLmcWxjP5Tcq9ZZ3WXJWBKB1v6wzHU,185
|
|
28
|
-
trovesuite/utils/helper.py,sha256=
|
|
28
|
+
trovesuite/utils/helper.py,sha256=NySt18kl4Dc78tN5HiB7SpsCH5DWy3QvG1AMtl-ASBM,26951
|
|
29
29
|
trovesuite/utils/templates.py,sha256=_92k4-EkqWs-h0LNJxPgorbspmp24kDngS7O3qWIFyQ,20388
|
|
30
|
-
trovesuite-1.0.
|
|
31
|
-
trovesuite-1.0.
|
|
32
|
-
trovesuite-1.0.
|
|
33
|
-
trovesuite-1.0.
|
|
34
|
-
trovesuite-1.0.
|
|
30
|
+
trovesuite-1.0.19.dist-info/licenses/LICENSE,sha256=EJT35ct-Q794JYPdAQy3XNczQGKkU1HzToLeK1YVw2s,1070
|
|
31
|
+
trovesuite-1.0.19.dist-info/METADATA,sha256=0h1PBqKcvc3fjKvXFgKepDCLnfNea1jdVJZphYPGyu4,21737
|
|
32
|
+
trovesuite-1.0.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
33
|
+
trovesuite-1.0.19.dist-info/top_level.txt,sha256=GzKhG_-MTaxeHrIgkGkBH_nof2vroGFBrjeHKWUIwNc,11
|
|
34
|
+
trovesuite-1.0.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|