Skip to content

Commit 1f54133

Browse files
nmveereshmadhav165
andauthored
Fix: Role Assignment Failure During Bootstrap Due to FK Constraint (#1175)
* modified granted by system to admin user emial Signed-off-by: Veeresh K <veeruveeresh1522@gmail.com> * Fix: reduce URL and slug column length to VARCHAR(191) to prevent MySQL index size error Signed-off-by: Veeresh K <veeruveeresh1522@gmail.com> * Fix: unit test to align with updated role assignment logic Signed-off-by: Veeresh K <veeruveeresh1522@gmail.com> * Fix: varchar to string Signed-off-by: Veeresh K <veeruveeresh1522@gmail.com> * Fix: varchar to string Signed-off-by: Veeresh K <veeruveeresh1522@gmail.com> * Revert slug and url length changes Signed-off-by: Madhav Kandukuri <madhav165@gmail.com> --------- Signed-off-by: Veeresh K <veeruveeresh1522@gmail.com> Co-authored-by: Madhav Kandukuri <madhav165@gmail.com>
1 parent 7b59267 commit 1f54133

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mcpgateway/bootstrap_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ async def bootstrap_default_roles() -> None:
194194
existing_assignment = await role_service.get_user_role_assignment(user_email=admin_user.email, role_id=platform_admin_role.id, scope="global", scope_id=None)
195195

196196
if not existing_assignment or not existing_assignment.is_active:
197-
await role_service.assign_role_to_user(user_email=admin_user.email, role_id=platform_admin_role.id, scope="global", scope_id=None, granted_by="system")
197+
await role_service.assign_role_to_user(user_email=admin_user.email, role_id=platform_admin_role.id, scope="global", scope_id=None, granted_by=admin_user.email)
198198
logger.info(f"Assigned platform_admin role to {admin_user.email}")
199199
else:
200200
logger.info("Admin user already has platform_admin role")

tests/unit/mcpgateway/test_bootstrap_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ async def test_bootstrap_roles_create_success(
290290
role_id=platform_admin_role.id,
291291
scope="global",
292292
scope_id=None,
293-
granted_by="system"
293+
granted_by=mock_admin_user.email
294294
)
295295

296296
mock_logger.info.assert_any_call(

0 commit comments

Comments
 (0)