fix: enforce platform role menu access

This commit is contained in:
2026-07-27 12:48:35 +08:00
parent cd58e1f6b6
commit 160172bf10
33 changed files with 481 additions and 107 deletions

View File

@@ -90,9 +90,18 @@ func CurrentProfile(ctx *gin.Context) {
infra.Response.Error(ctx, errcode.ErrRecordNotFound)
return
}
menus, err := loadPlatformMenus(account.PlatformRoleCode)
if err != nil {
infra.Response.Error(ctx, errcode.ErrPermissionDenied)
return
}
menuCodes := make([]string, 0, len(menus))
for _, menu := range menus {
menuCodes = append(menuCodes, menu.MenuCode)
}
infra.Response.Success(ctx, gin.H{
"identity": account.Identity, "username": account.Username, "display_name": account.DisplayName,
"avatar": account.Avatar, "role_code": account.PlatformRoleCode,
"avatar": account.Avatar, "role_code": account.PlatformRoleCode, "menu_codes": menuCodes,
})
}