Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: user api comment for acl (#13065)
Danny Xud4c8f4abce0c
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.goindex 6591f65641..1258d19216 100644--- a/backend/api/v1/auth_service.go+++ b/backend/api/v1/auth_service.go@@ -124,6 +124,7 @@ func (s *AuthService) CreateUser(ctx context.Context, request *v1pb.CreateUserRe}if setting.DisallowSignup {+ // TODO(d): use fine-grained permission.rolePtr := ctx.Value(common.RoleContextKey)if rolePtr == nil || rolePtr.(api.Role) != api.WorkspaceAdmin {return nil, status.Errorf(codes.PermissionDenied, "sign up is disallowed")diff --git a/frontend/src/types/proto/v1/auth_service.ts b/frontend/src/types/proto/v1/auth_service.tsindex 2e14e5f271..97c1c999bc 100644--- a/frontend/src/types/proto/v1/auth_service.ts+++ b/frontend/src/types/proto/v1/auth_service.ts@@ -1445,6 +1445,10 @@ export const AuthServiceDefinition = {name: "AuthService",fullName: "bytebase.v1.AuthService",methods: {+ /**+ * Get the user.+ * Any authenticated user can get the user.+ */getUser: {name: "GetUser",requestType: GetUserRequest,@@ -1483,6 +1487,10 @@ export const AuthServiceDefinition = {},},},+ /**+ * List all users.+ * Any authenticated user can list users.+ */listUsers: {name: "ListUsers",requestType: ListUsersRequest,@@ -1497,6 +1505,11 @@ export const AuthServiceDefinition = {},},},+ /**+ * Create a user.+ * When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.+ * Otherwise, any unauthenticated user can create a user.+ */createUser: {name: "CreateUser",requestType: CreateUserRequest,@@ -1513,6 +1526,7 @@ export const AuthServiceDefinition = {},},},+ /** Only the user itself and the user with bb.users.create permission on the workspace can update the user. */updateUser: {name: "UpdateUser",requestType: UpdateUserRequest,@@ -1563,6 +1577,10 @@ export const AuthServiceDefinition = {},},},+ /**+ * Only the user with bb.users.delete permission on the workspace can delete the user.+ * The last remaining workspace admin cannot be deleted.+ */deleteUser: {name: "DeleteUser",requestType: DeleteUserRequest,@@ -1601,6 +1619,7 @@ export const AuthServiceDefinition = {},},},+ /** Only the user with bb.users.undelete permission on the workspace can undelete the user. */undeleteUser: {name: "UndeleteUser",requestType: UndeleteUserRequest,diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex b9dba49d4e..25a5a8c14a 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -7332,6 +7332,9 @@ paths:get:tags:- AuthService+ description: |-+ List all users.+ Any authenticated user can list users.operationId: AuthService_ListUsersparameters:- name: pageSize@@ -7375,6 +7378,10 @@ paths:post:tags:- AuthService+ description: |-+ Create a user.+ When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.+ Otherwise, any unauthenticated user can create a user.operationId: AuthService_CreateUserrequestBody:content:@@ -7399,6 +7406,9 @@ paths:get:tags:- AuthService+ description: |-+ Get the user.+ Any authenticated user can get the user.operationId: AuthService_GetUserparameters:- name: user@@ -7423,6 +7433,9 @@ paths:delete:tags:- AuthService+ description: |-+ Only the user with bb.users.delete permission on the workspace can delete the user.+ The last remaining workspace admin cannot be deleted.operationId: AuthService_DeleteUserparameters:- name: user@@ -7444,6 +7457,7 @@ paths:patch:tags:- AuthService+ description: Only the user itself and the user with bb.users.create permission on the workspace can update the user.operationId: AuthService_UpdateUserparameters:- name: user@@ -7498,6 +7512,7 @@ paths:post:tags:- AuthService+ description: Only the user with bb.users.undelete permission on the workspace can undelete the user.operationId: AuthService_UndeleteUserparameters:- name: userdiff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 7aa53f73fc..47e0db5ef1 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -1715,12 +1715,12 @@ The user's `name` field is used to identify the user to update. Format: user| Method Name | Request Type | Response Type | Description || ----------- | ------------ | ------------- | ------------|-| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | |-| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | |-| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | |-| UpdateUser | [UpdateUserRequest](#bytebase-v1-UpdateUserRequest) | [User](#bytebase-v1-User) | |-| DeleteUser | [DeleteUserRequest](#bytebase-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |-| UndeleteUser | [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest) | [User](#bytebase-v1-User) | |+| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | Get the user. Any authenticated user can get the user. |+| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | List all users. Any authenticated user can list users. |+| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | Create a user. When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user. Otherwise, any unauthenticated user can create a user. |+| UpdateUser | [UpdateUserRequest](#bytebase-v1-UpdateUserRequest) | [User](#bytebase-v1-User) | Only the user itself and the user with bb.users.create permission on the workspace can update the user. |+| DeleteUser | [DeleteUserRequest](#bytebase-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Only the user with bb.users.delete permission on the workspace can delete the user. The last remaining workspace admin cannot be deleted. |+| UndeleteUser | [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest) | [User](#bytebase-v1-User) | Only the user with bb.users.undelete permission on the workspace can undelete the user. || Login | [LoginRequest](#bytebase-v1-LoginRequest) | [LoginResponse](#bytebase-v1-LoginResponse) | || Logout | [LogoutRequest](#bytebase-v1-LogoutRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 963e040b95..32e020005c 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -5307,42 +5307,47 @@ Could be empty. </p></td><td>GetUser</td><td><a href="#bytebase.v1.GetUserRequest">GetUserRequest</a></td><td><a href="#bytebase.v1.User">User</a></td>- <td><p></p></td>+ <td><p>Get the user.+Any authenticated user can get the user.</p></td></tr><tr><td>ListUsers</td><td><a href="#bytebase.v1.ListUsersRequest">ListUsersRequest</a></td><td><a href="#bytebase.v1.ListUsersResponse">ListUsersResponse</a></td>- <td><p></p></td>+ <td><p>List all users.+Any authenticated user can list users.</p></td></tr><tr><td>CreateUser</td><td><a href="#bytebase.v1.CreateUserRequest">CreateUserRequest</a></td><td><a href="#bytebase.v1.User">User</a></td>- <td><p></p></td>+ <td><p>Create a user.+When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.+Otherwise, any unauthenticated user can create a user.</p></td></tr><tr><td>UpdateUser</td><td><a href="#bytebase.v1.UpdateUserRequest">UpdateUserRequest</a></td><td><a href="#bytebase.v1.User">User</a></td>- <td><p></p></td>+ <td><p>Only the user itself and the user with bb.users.create permission on the workspace can update the user.</p></td></tr><tr><td>DeleteUser</td><td><a href="#bytebase.v1.DeleteUserRequest">DeleteUserRequest</a></td><td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>- <td><p></p></td>+ <td><p>Only the user with bb.users.delete permission on the workspace can delete the user.+The last remaining workspace admin cannot be deleted.</p></td></tr><tr><td>UndeleteUser</td><td><a href="#bytebase.v1.UndeleteUserRequest">UndeleteUserRequest</a></td><td><a href="#bytebase.v1.User">User</a></td>- <td><p></p></td>+ <td><p>Only the user with bb.users.undelete permission on the workspace can undelete the user.</p></td></tr><tr>diff --git a/proto/generated-go/v1/auth_service_grpc.pb.go b/proto/generated-go/v1/auth_service_grpc.pb.goindex 828dd0fea1..db729b6c8e 100644--- a/proto/generated-go/v1/auth_service_grpc.pb.go+++ b/proto/generated-go/v1/auth_service_grpc.pb.go@@ -34,11 +34,22 @@ const (//// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.type AuthServiceClient interface {+ // Get the user.+ // Any authenticated user can get the user.GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error)+ // List all users.+ // Any authenticated user can list users.ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error)+ // Create a user.+ // When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.+ // Otherwise, any unauthenticated user can create a user.CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error)+ // Only the user itself and the user with bb.users.create permission on the workspace can update the user.UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*User, error)+ // Only the user with bb.users.delete permission on the workspace can delete the user.+ // The last remaining workspace admin cannot be deleted.DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)+ // Only the user with bb.users.undelete permission on the workspace can undelete the user.UndeleteUser(ctx context.Context, in *UndeleteUserRequest, opts ...grpc.CallOption) (*User, error)Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)@@ -136,11 +147,22 @@ func (c *authServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts// All implementations must embed UnimplementedAuthServiceServer// for forward compatibilitytype AuthServiceServer interface {+ // Get the user.+ // Any authenticated user can get the user.GetUser(context.Context, *GetUserRequest) (*User, error)+ // List all users.+ // Any authenticated user can list users.ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error)+ // Create a user.+ // When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.+ // Otherwise, any unauthenticated user can create a user.CreateUser(context.Context, *CreateUserRequest) (*User, error)+ // Only the user itself and the user with bb.users.create permission on the workspace can update the user.UpdateUser(context.Context, *UpdateUserRequest) (*User, error)+ // Only the user with bb.users.delete permission on the workspace can delete the user.+ // The last remaining workspace admin cannot be deleted.DeleteUser(context.Context, *DeleteUserRequest) (*emptypb.Empty, error)+ // Only the user with bb.users.undelete permission on the workspace can undelete the user.UndeleteUser(context.Context, *UndeleteUserRequest) (*User, error)Login(context.Context, *LoginRequest) (*LoginResponse, error)Logout(context.Context, *LogoutRequest) (*emptypb.Empty, error)diff --git a/proto/v1/auth_service.proto b/proto/v1/auth_service.protoindex c7760ffcea..9574c0de6c 100644--- a/proto/v1/auth_service.proto+++ b/proto/v1/auth_service.proto@@ -14,18 +14,25 @@ import "v1/common.proto";option go_package = "generated-go/v1";service AuthService {+ // Get the user.+ // Any authenticated user can get the user.rpc GetUser(GetUserRequest) returns (User) {option (google.api.http) = {get: "/v1/{name=users/*}"};option (google.api.method_signature) = "name";option (bytebase.v1.auth_method) = CUSTOM;}+ // List all users.+ // Any authenticated user can list users.rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {option (google.api.http) = {get: "/v1/users"};option (google.api.method_signature) = "parent";option (bytebase.v1.auth_method) = CUSTOM;}+ // Create a user.+ // When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.+ // Otherwise, any unauthenticated user can create a user.rpc CreateUser(CreateUserRequest) returns (User) {option (google.api.http) = {post: "/v1/users"@@ -37,6 +44,7 @@ service AuthService {option (bytebase.v1.audit) = true;}+ // Only the user itself and the user with bb.users.create permission on the workspace can update the user.rpc UpdateUser(UpdateUserRequest) returns (User) {option (google.api.http) = {patch: "/v1/{user.name=users/*}"@@ -47,12 +55,15 @@ service AuthService {option (bytebase.v1.audit) = true;}+ // Only the user with bb.users.delete permission on the workspace can delete the user.+ // The last remaining workspace admin cannot be deleted.rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) {option (google.api.http) = {delete: "/v1/{name=users/*}"};option (google.api.method_signature) = "name";option (bytebase.v1.auth_method) = CUSTOM;}+ // Only the user with bb.users.undelete permission on the workspace can undelete the user.rpc UndeleteUser(UndeleteUserRequest) returns (User) {option (google.api.http) = {post: "/v1/{name=users/*}:undelete"