fix platform workflow integrity and permissions
This commit is contained in:
@@ -58,12 +58,22 @@ func Login(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
extend := map[string]string{"username": account.Username, "display_name": account.DisplayName}
|
||||
if account.PlatformRoleCode == "root" {
|
||||
extend["location_scope"] = "precise"
|
||||
} else {
|
||||
var role models.PlatformRole
|
||||
if impl.DBService.Select("data_scope").Where("role_code = ? AND status = ?", account.PlatformRoleCode, common.StatusEnable).First(&role).Error == nil &&
|
||||
role.DataScope == "precise" {
|
||||
extend["location_scope"] = "precise"
|
||||
}
|
||||
}
|
||||
accessToken, err := token.New(env.Runtime.JwtSecretKey).GenerateJwt(
|
||||
0,
|
||||
account.Identity,
|
||||
"platform_admin",
|
||||
account.PlatformRoleCode,
|
||||
map[string]string{"username": account.Username, "display_name": account.DisplayName},
|
||||
extend,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
@@ -99,7 +109,7 @@ func CurrentProfile(ctx *gin.Context) {
|
||||
menuCodes := make([]string, 0, len(menus))
|
||||
seenMenuCodes := make(map[string]bool, len(menus))
|
||||
for _, menu := range menus {
|
||||
codes := []string{menu.MenuCode}
|
||||
codes := []string{menu.Identity}
|
||||
if path := strings.Trim(menu.Path, "/"); path != "" {
|
||||
codes = append(codes, strings.Split(path, "/")[0])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user