fix: enforce platform role menu access
This commit is contained in:
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user