fix: grant v2 collection name and privilege error typo (#38195)

issue: https://github.com/milvus-io/milvus/issues/38042

Signed-off-by: shaoting-huang <shaoting.huang@zilliz.com>
pull/38212/head
sthuang 2024-12-04 16:14:38 +08:00 committed by GitHub
parent 262f6db3d8
commit a65d395ecd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View File

@ -5365,7 +5365,7 @@ func (node *Proxy) validateOperatePrivilegeV2Params(req *milvuspb.OperatePrivile
return err
}
}
if err := ValidateObjectName(req.CollectionName); err != nil {
if err := ValidateCollectionName(req.CollectionName); err != nil {
return err
}
return nil

View File

@ -1102,6 +1102,13 @@ func ValidateObjectName(entity string) error {
return validateName(entity, "object name")
}
func ValidateCollectionName(entity string) error {
if util.IsAnyWord(entity) {
return nil
}
return validateName(entity, "collection name")
}
func ValidateObjectType(entity string) error {
return validateName(entity, "ObjectType")
}

View File

@ -461,7 +461,7 @@ func WrapErrDatabaseNameInvalid(database any, msg ...string) error {
}
func WrapErrPrivilegeGroupNameInvalid(privilegeGroup any, msg ...string) error {
err := wrapFields(ErrPrivilegeGroupInvalidName, value("privielgeGroup", privilegeGroup))
err := wrapFields(ErrPrivilegeGroupInvalidName, value("privilegeGroup", privilegeGroup))
if len(msg) > 0 {
err = errors.Wrap(err, strings.Join(msg, "->"))
}