From f9f2dd0cbd5b6669f8f9b6ff270be4a84fc832e9 Mon Sep 17 00:00:00 2001 From: disksing Date: Thu, 4 Aug 2022 11:22:53 +0800 Subject: [PATCH] allow create role without prefix (#15) Signed-off-by: disksing --- executor/simple.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor/simple.go b/executor/simple.go index a142adc4a6797..6f9414330afc4 100644 --- a/executor/simple.go +++ b/executor/simple.go @@ -804,7 +804,7 @@ func (e *SimpleExec) executeCreateUser(ctx context.Context, s *ast.CreateUserStm users := make([]*auth.UserIdentity, 0, len(s.Specs)) for _, spec := range s.Specs { - if userPrefix != "" && !strings.HasPrefix(spec.User.Username, userPrefix+".") && spec.User.Username != "cloud_admin" { + if userPrefix != "" && !s.IsCreateRole && !strings.HasPrefix(spec.User.Username, userPrefix+".") && spec.User.Username != "cloud_admin" { return ErrUserNameNeedPrefix.GenWithStackByArgs(userPrefix, userPrefix, spec.User.Username) } if len(spec.User.Username) > auth.UserNameMaxLength {