Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: relax error

d-bytebaseba633508fe9b
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.go
index 4b4cc83b1a..f10ae94b87 100644
--- a/backend/api/v1/auth_service.go
+++ b/backend/api/v1/auth_service.go
@@ -207,15 +207,14 @@ func (s *AuthService) CreateUser(ctx context.Context, request *v1pb.CreateUserRe
}
if !firstUser {
rolePtr := ctx.Value(common.RoleContextKey)
- if rolePtr == nil || rolePtr.(api.Role) != api.WorkspaceAdmin {
- return nil, status.Errorf(codes.InvalidArgument, "cannot specify roles")
- }
- for _, role := range request.User.Roles {
- roleID, err := common.GetRoleID(role)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, err.Error())
+ if rolePtr != nil && rolePtr.(api.Role) == api.WorkspaceAdmin {
+ for _, role := range request.User.Roles {
+ roleID, err := common.GetRoleID(role)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, err.Error())
+ }
+ userMessage.Roles = append(userMessage.Roles, api.Role(roleID))
}
- userMessage.Roles = append(userMessage.Roles, api.Role(roleID))
}
}
// If multiple roles are specified, checks if the current user is workspace admin.
diff --git a/frontend/src/store/modules/auth.ts b/frontend/src/store/modules/auth.ts
index 13354ff34c..ed91d6a53b 100644
--- a/frontend/src/store/modules/auth.ts
+++ b/frontend/src/store/modules/auth.ts
@@ -4,7 +4,7 @@ import { defineStore } from "pinia";
import { computed } from "vue";
import { authServiceClient } from "@/grpcweb";
import type { SignupInfo, ActivateInfo } from "@/types";
-import { unknownUser, PresetRoleType } from "@/types";
+import { unknownUser } from "@/types";
import type {
LoginRequest,
LoginResponse,
@@ -49,7 +49,6 @@ export const useAuthStore = defineStore("auth_v1", {
title: signupInfo.name,
password: signupInfo.password,
userType: UserType.USER,
- roles: [PresetRoleType.WORKSPACE_MEMBER],
},
});
await this.login({