Skip to content

Commit

Permalink
allow create role without prefix (pingcap#15)
Browse files Browse the repository at this point in the history
Signed-off-by: disksing <[email protected]>
  • Loading branch information
disksing authored Aug 4, 2022
1 parent e28ae8c commit f9f2dd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion executor/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f9f2dd0

Please sign in to comment.