Skip to content

Commit

Permalink
fix(backend): 权限服务空指针异常 #8827
Browse files Browse the repository at this point in the history
  • Loading branch information
xfwduke committed Dec 25, 2024
1 parent 6d8bc3d commit d54c10a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dbm-services/mysql/db-priv/service/v2/add_priv/add_priv.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ func (c *PrivTaskPara) AddPriv(jsonPara, ticket string) (err error) {
if c.ClusterType == "" {
return errno.ClusterTypeIsEmpty
}
if c.SourceIPs == nil || len(c.SourceIPs) == 0 {
return errno.GrantPrivilegesParameterCheckFail
}
if c.TargetInstances == nil || len(c.TargetInstances) == 0 {
return errno.GrantPrivilegesParameterCheckFail
}
if c.AccoutRules == nil || len(c.AccoutRules) == 0 {
return errno.GrantPrivilegesParameterCheckFail
}
if c.User == "" {
return errno.GrantPrivilegesParameterCheckFail
}
if c.ClusterType == "" {
return errno.GrantPrivilegesParameterCheckFail
}

c.SourceIPs = internal.UniqueStringSlice(c.SourceIPs)
// targetInstance 传入的其实全是域名
Expand Down

0 comments on commit d54c10a

Please sign in to comment.