Skip to content

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

fix: update group iam (#13154)

Danny Xu130ba997419b
diff --git a/backend/api/v1/org_policy_service.go b/backend/api/v1/org_policy_service.go
index d99b3f685f..df84e97590 100644
--- a/backend/api/v1/org_policy_service.go
+++ b/backend/api/v1/org_policy_service.go
@@ -1061,7 +1061,7 @@ func (s *OrgPolicyService) convertToV1PBMaskingExceptionPolicyPayload(ctx contex
}
member = fmt.Sprintf("user:%s", user.Email)
} else {
- email, err := common.GetUserGroupEmail(member)
+ email, err := common.GetGroupEmail(member)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to parse group email from member %s with error: %v", member, err)
}
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.go
index 532cad2c7f..961f4ea75c 100644
--- a/backend/api/v1/project_service.go
+++ b/backend/api/v1/project_service.go
@@ -1202,7 +1202,7 @@ func convertToV1IamPolicy(ctx context.Context, stores *store.Store, iamPolicy *s
}
members = append(members, fmt.Sprintf("user:%s", user.Email))
} else if strings.HasPrefix(member, common.UserGroupPrefix) {
- email, err := common.GetUserGroupEmail(member)
+ email, err := common.GetGroupEmail(member)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to parse group email from member %s with error: %v", member, err)
}
diff --git a/backend/api/v1/user_group_service.go b/backend/api/v1/user_group_service.go
index 430736ad24..22a6172cd2 100644
--- a/backend/api/v1/user_group_service.go
+++ b/backend/api/v1/user_group_service.go
@@ -32,7 +32,7 @@ func NewUserGroupService(store *store.Store, iamManager *iam.Manager) *UserGroup
// GetUserGroup gets a group.
func (s *UserGroupService) GetUserGroup(ctx context.Context, request *v1pb.GetUserGroupRequest) (*v1pb.UserGroup, error) {
- email, err := common.GetUserGroupEmail(request.Name)
+ email, err := common.GetGroupEmail(request.Name)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}
@@ -96,7 +96,7 @@ func (s *UserGroupService) CreateUserGroup(ctx context.Context, request *v1pb.Cr
// UpdateUserGroup updates a group.
func (s *UserGroupService) UpdateUserGroup(ctx context.Context, request *v1pb.UpdateUserGroupRequest) (*v1pb.UserGroup, error) {
- email, err := common.GetUserGroupEmail(request.Group.Name)
+ groupEmail, err := common.GetGroupEmail(request.Group.Name)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}
@@ -106,7 +106,7 @@ func (s *UserGroupService) UpdateUserGroup(ctx context.Context, request *v1pb.Up
return nil, status.Errorf(codes.Internal, "principal ID not found")
}
- if err := s.checkPermission(ctx, email, iam.PermissionUserGroupsUpdate); err != nil {
+ if err := s.checkPermission(ctx, groupEmail); err != nil {
return nil, err
}
@@ -128,7 +128,7 @@ func (s *UserGroupService) UpdateUserGroup(ctx context.Context, request *v1pb.Up
}
}
- groupMessage, err := s.store.UpdateUserGroup(ctx, email, patch, principalID)
+ groupMessage, err := s.store.UpdateUserGroup(ctx, groupEmail, patch, principalID)
if err != nil {
return nil, status.Errorf(codes.Internal, err.Error())
}
@@ -138,15 +138,11 @@ func (s *UserGroupService) UpdateUserGroup(ctx context.Context, request *v1pb.Up
// DeleteUserGroup deletes a group.
func (s *UserGroupService) DeleteUserGroup(ctx context.Context, request *v1pb.DeleteUserGroupRequest) (*emptypb.Empty, error) {
- email, err := common.GetUserGroupEmail(request.Name)
+ email, err := common.GetGroupEmail(request.Name)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}
- if err := s.checkPermission(ctx, email, iam.PermissionUserGroupsDelete); err != nil {
- return nil, err
- }
-
if err := s.store.DeleteUserGroup(ctx, email); err != nil {
return nil, status.Errorf(codes.Internal, err.Error())
}
@@ -154,11 +150,12 @@ func (s *UserGroupService) DeleteUserGroup(ctx context.Context, request *v1pb.De
return &emptypb.Empty{}, nil
}
-func (s *UserGroupService) checkPermission(ctx context.Context, groupEmail string, permission iam.Permission) error {
+func (s *UserGroupService) checkPermission(ctx context.Context, groupEmail string) error {
user, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)
if !ok {
return status.Errorf(codes.Internal, "user not found")
}
+ userName := common.FormatUserUID(user.ID)
group, err := s.store.GetUserGroup(ctx, groupEmail)
if err != nil {
@@ -168,16 +165,17 @@ func (s *UserGroupService) checkPermission(ctx context.Context, groupEmail strin
return status.Errorf(codes.NotFound, "group %q not found", groupEmail)
}
for _, member := range group.Payload.GetMembers() {
- if member.Role == storepb.UserGroupMember_OWNER && member.Member == common.FormatUserUID(user.ID) {
+ if member.Role == storepb.UserGroupMember_OWNER && member.Member == userName {
return nil
}
}
- hasPermission, err := s.iamManager.CheckPermission(ctx, permission, user)
+
+ ok, err = s.iamManager.CheckPermission(ctx, iam.PermissionUserGroupsUpdate, user)
if err != nil {
return status.Errorf(codes.Internal, "failed to check permission with error: %v", err)
}
- if !hasPermission {
- return status.Errorf(codes.PermissionDenied, "permission denied: %v", permission)
+ if !ok {
+ return status.Errorf(codes.PermissionDenied, "only group owner or user with permission %q can update group", iam.PermissionUserGroupsUpdate)
}
return nil
}
@@ -214,7 +212,7 @@ func (s *UserGroupService) convertToGroupPayload(ctx context.Context, group *v1p
}
func (s *UserGroupService) convertToGroupMessage(ctx context.Context, group *v1pb.UserGroup) (*store.UserGroupMessage, error) {
- email, err := common.GetUserGroupEmail(group.Name)
+ email, err := common.GetGroupEmail(group.Name)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}
diff --git a/backend/common/resource_name.go b/backend/common/resource_name.go
index 39780e4558..6b6e1812d8 100644
--- a/backend/common/resource_name.go
+++ b/backend/common/resource_name.go
@@ -532,8 +532,8 @@ func GetWorkspaceProjectVCSConnectorID(name string) (string, string, string, err
return tokens[0], tokens[1], tokens[2], nil
}
-// GetUserGroupEmail returns the group email.
-func GetUserGroupEmail(name string) (string, error) {
+// GetGroupEmail returns the group email.
+func GetGroupEmail(name string) (string, error) {
tokens, err := GetNameParentTokens(name, UserGroupPrefix)
if err != nil {
return "", err
diff --git a/backend/utils/member.go b/backend/utils/member.go
index 7801229636..64160378ce 100644
--- a/backend/utils/member.go
+++ b/backend/utils/member.go
@@ -66,7 +66,7 @@ func GetUsersByMember(ctx context.Context, stores *store.Store, member string) [
users = append(users, user)
}
} else if strings.HasPrefix(member, common.UserGroupPrefix) {
- groupEmail, err := common.GetUserGroupEmail(member)
+ groupEmail, err := common.GetGroupEmail(member)
if err != nil {
slog.Error("failed to parse group email", slog.String("group", member), log.BBError(err))
return users
@@ -127,7 +127,7 @@ func GetUserIAMPolicyBindings(ctx context.Context, stores *store.Store, user *st
break
}
if strings.HasPrefix(member, common.UserGroupPrefix) {
- groupEmail, err := common.GetUserGroupEmail(member)
+ groupEmail, err := common.GetGroupEmail(member)
if err != nil {
slog.Error("failed to parse group email", slog.String("group", member), log.BBError(err))
continue
diff --git a/frontend/src/types/proto/v1/user_group.ts b/frontend/src/types/proto/v1/user_group.ts
index bb13cffadd..a06a7ce305 100644
--- a/frontend/src/types/proto/v1/user_group.ts
+++ b/frontend/src/types/proto/v1/user_group.ts
@@ -136,7 +136,7 @@ export function userGroupMember_RoleToNumber(object: UserGroupMember_Role): numb
export interface UserGroup {
/**
* The name of the group to retrieve.
- * Format: userGroups/{userGroup}, userGroup is an email.
+ * Format: groups/{userGroup}, userGroup is an email.
*/
name: string;
title: string;
@@ -863,6 +863,10 @@ export const UserGroupServiceDefinition = {
},
},
},
+ /**
+ * UpdateUserGroup updates the user group.
+ * Users with "bb.userGroups.update" permission on the workspace or the user group owner can access this method.
+ */
updateUserGroup: {
name: "UpdateUserGroup",
requestType: UpdateUserGroupRequest,
@@ -897,7 +901,7 @@ export const UserGroupServiceDefinition = {
101,
]),
],
- 800016: [new Uint8Array([1])],
+ 800016: [new Uint8Array([2])],
578365826: [
new Uint8Array([
34,
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 805cf4ec3a..39c8d151ab 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -975,6 +975,9 @@ paths:
patch:
tags:
- UserGroupService
+ description: |-
+ UpdateUserGroup updates the user group.
+ Users with "bb.userGroups.update" permission on the workspace or the user group owner can access this method.
operationId: UserGroupService_UpdateUserGroup
parameters:
- name: group
@@ -14043,7 +14046,7 @@ components:
type: string
description: |-
The name of the group to retrieve.
- Format: userGroups/{userGroup}, userGroup is an email.
+ Format: groups/{userGroup}, userGroup is an email.
title:
type: string
description:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index f249df5097..e990857f58 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -10537,7 +10537,7 @@ The group's `name` field is used to identify the group to update. Format: gr
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the group to retrieve. Format: userGroups/{userGroup}, userGroup is an email. |
+| name | [string](#string) | | The name of the group to retrieve. Format: groups/{userGroup}, userGroup is an email. |
| title | [string](#string) | | |
| description | [string](#string) | | |
| creator | [string](#string) | | The name for the creator. Format: users/[email protected] |
@@ -10596,7 +10596,7 @@ Format: users/[email protected] |
| GetUserGroup | [GetUserGroupRequest](#bytebase-v1-GetUserGroupRequest) | [UserGroup](#bytebase-v1-UserGroup) | |
| ListUserGroups | [ListUserGroupsRequest](#bytebase-v1-ListUserGroupsRequest) | [ListUserGroupsResponse](#bytebase-v1-ListUserGroupsResponse) | |
| CreateUserGroup | [CreateUserGroupRequest](#bytebase-v1-CreateUserGroupRequest) | [UserGroup](#bytebase-v1-UserGroup) | |
-| UpdateUserGroup | [UpdateUserGroupRequest](#bytebase-v1-UpdateUserGroupRequest) | [UserGroup](#bytebase-v1-UserGroup) | |
+| UpdateUserGroup | [UpdateUserGroupRequest](#bytebase-v1-UpdateUserGroupRequest) | [UserGroup](#bytebase-v1-UserGroup) | UpdateUserGroup updates the user group. Users with "bb.userGroups.update" permission on the workspace or the user group owner can access this method. |
| DeleteUserGroup | [DeleteUserGroupRequest](#bytebase-v1-DeleteUserGroupRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index cbf7d435da..fc047cd41e 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -28870,7 +28870,7 @@ Format: groups/{email} </p></td>
<td><a href="#string">string</a></td>
<td></td>
<td><p>The name of the group to retrieve.
-Format: userGroups/{userGroup}, userGroup is an email. </p></td>
+Format: groups/{userGroup}, userGroup is an email. </p></td>
</tr>
<tr>
@@ -29017,7 +29017,8 @@ Format: users/[email protected] </p></td>
<td>UpdateUserGroup</td>
<td><a href="#bytebase.v1.UpdateUserGroupRequest">UpdateUserGroupRequest</a></td>
<td><a href="#bytebase.v1.UserGroup">UserGroup</a></td>
- <td><p></p></td>
+ <td><p>UpdateUserGroup updates the user group.
+Users with &#34;bb.userGroups.update&#34; permission on the workspace or the user group owner can access this method.</p></td>
</tr>
<tr>
diff --git a/proto/generated-go/v1/user_group.pb.go b/proto/generated-go/v1/user_group.pb.go
index d38e8fbb5b..6fb36522df 100644
--- a/proto/generated-go/v1/user_group.pb.go
+++ b/proto/generated-go/v1/user_group.pb.go
@@ -465,7 +465,7 @@ type UserGroup struct {
unknownFields protoimpl.UnknownFields
// The name of the group to retrieve.
- // Format: userGroups/{userGroup}, userGroup is an email.
+ // Format: groups/{userGroup}, userGroup is an email.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
@@ -615,7 +615,7 @@ var file_v1_user_group_proto_rawDesc = []byte{
0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x22, 0x33, 0x0a, 0x04, 0x52, 0x6f, 0x6c,
0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43,
0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x57, 0x4e, 0x45, 0x52,
- 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0xad,
+ 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0xa9,
0x02, 0x0a, 0x09, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x18, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18,
@@ -631,59 +631,59 @@ var file_v1_user_group_proto_rawDesc = []byte{
0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69,
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x0a, 0x63,
- 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x3a, 0x33, 0xea, 0x41, 0x30, 0x0a, 0x16,
+ 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x3a, 0x2f, 0xea, 0x41, 0x2c, 0x0a, 0x16,
0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x73, 0x65,
- 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x16, 0x75, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75,
- 0x70, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x7d, 0x32, 0xf3,
- 0x05, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x65, 0x72, 0x76,
- 0x69, 0x63, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47,
- 0x72, 0x6f, 0x75, 0x70, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
- 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x3b,
- 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x8a, 0xea, 0x30, 0x11, 0x62, 0x62, 0x2e, 0x75, 0x73,
- 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x90, 0xea, 0x30, 0x01,
- 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d,
- 0x65, 0x3d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x8a, 0x01, 0x0a, 0x0e,
- 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x22,
+ 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x7b,
+ 0x75, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x7d, 0x32, 0xf3, 0x05, 0x0a, 0x10, 0x55,
+ 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
+ 0x85, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70,
+ 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47,
+ 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
+ 0x2e, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x3b, 0xda, 0x41, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x8a, 0xea, 0x30, 0x11, 0x62, 0x62, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x47, 0x72,
+ 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93,
+ 0x02, 0x15, 0x12, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x67, 0x72,
+ 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x8a, 0x01, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74,
+ 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x22, 0x2e, 0x62, 0x79, 0x74,
+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65,
+ 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23,
0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,
- 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
- 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0xda, 0x41, 0x00, 0x8a, 0xea, 0x30, 0x12,
- 0x62, 0x62, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x6c, 0x69,
- 0x73, 0x74, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12, 0x0a, 0x2f, 0x76,
- 0x31, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x8d, 0x01, 0x0a, 0x0f, 0x43, 0x72, 0x65,
- 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x23, 0x2e, 0x62,
- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74,
- 0x65, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x1a, 0x16, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
- 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x3d, 0xda, 0x41, 0x05, 0x67, 0x72,
- 0x6f, 0x75, 0x70, 0x8a, 0xea, 0x30, 0x14, 0x62, 0x62, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x47, 0x72,
- 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x90, 0xea, 0x30, 0x01, 0x82,
- 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x0a, 0x2f, 0x76,
- 0x31, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0xa8, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64,
- 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x23, 0x2e, 0x62,
- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,
- 0x65, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x1a, 0x16, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
- 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x58, 0xda, 0x41, 0x11, 0x67, 0x72,
- 0x6f, 0x75, 0x70, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x8a,
+ 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x22, 0x2f, 0xda, 0x41, 0x00, 0x8a, 0xea, 0x30, 0x12, 0x62, 0x62, 0x2e, 0x75,
+ 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x6c, 0x69, 0x73, 0x74, 0x90, 0xea,
+ 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72,
+ 0x6f, 0x75, 0x70, 0x73, 0x12, 0x8d, 0x01, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55,
+ 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65,
+ 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,
+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72,
+ 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x3d, 0xda, 0x41, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x8a,
0xea, 0x30, 0x14, 0x62, 0x62, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73,
- 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02,
- 0x22, 0x3a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x32, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x67,
- 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73,
- 0x2f, 0x2a, 0x7d, 0x12, 0x8e, 0x01, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73,
- 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72,
- 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67,
- 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
- 0x6d, 0x70, 0x74, 0x79, 0x22, 0x3e, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x8a, 0xea, 0x30,
- 0x14, 0x62, 0x62, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x64,
- 0x65, 0x6c, 0x65, 0x74, 0x65, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x2a,
- 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x67, 0x72, 0x6f, 0x75, 0x70,
- 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
- 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02,
+ 0x13, 0x3a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72,
+ 0x6f, 0x75, 0x70, 0x73, 0x12, 0xa8, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55,
+ 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65,
+ 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,
+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72,
+ 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x58, 0xda, 0x41, 0x11, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2c,
+ 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x8a, 0xea, 0x30, 0x14, 0x62,
+ 0x62, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x75, 0x70, 0x64,
+ 0x61, 0x74, 0x65, 0x90, 0xea, 0x30, 0x02, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x05, 0x67,
+ 0x72, 0x6f, 0x75, 0x70, 0x32, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x67, 0x72, 0x6f, 0x75, 0x70,
+ 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x2a, 0x7d, 0x12,
+ 0x8e, 0x01, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72,
+ 0x6f, 0x75, 0x70, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
+ 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75,
+ 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
+ 0x22, 0x3e, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x8a, 0xea, 0x30, 0x14, 0x62, 0x62, 0x2e,
+ 0x75, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x64, 0x65, 0x6c, 0x65, 0x74,
+ 0x65, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x2a, 0x13, 0x2f, 0x76, 0x31,
+ 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x2a, 0x7d,
+ 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f,
+ 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/proto/generated-go/v1/user_group_grpc.pb.go b/proto/generated-go/v1/user_group_grpc.pb.go
index 8099d5c451..75942bb165 100644
--- a/proto/generated-go/v1/user_group_grpc.pb.go
+++ b/proto/generated-go/v1/user_group_grpc.pb.go
@@ -34,6 +34,8 @@ type UserGroupServiceClient interface {
GetUserGroup(ctx context.Context, in *GetUserGroupRequest, opts ...grpc.CallOption) (*UserGroup, error)
ListUserGroups(ctx context.Context, in *ListUserGroupsRequest, opts ...grpc.CallOption) (*ListUserGroupsResponse, error)
CreateUserGroup(ctx context.Context, in *CreateUserGroupRequest, opts ...grpc.CallOption) (*UserGroup, error)
+ // UpdateUserGroup updates the user group.
+ // Users with "bb.userGroups.update" permission on the workspace or the user group owner can access this method.
UpdateUserGroup(ctx context.Context, in *UpdateUserGroupRequest, opts ...grpc.CallOption) (*UserGroup, error)
DeleteUserGroup(ctx context.Context, in *DeleteUserGroupRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
@@ -103,6 +105,8 @@ type UserGroupServiceServer interface {
GetUserGroup(context.Context, *GetUserGroupRequest) (*UserGroup, error)
ListUserGroups(context.Context, *ListUserGroupsRequest) (*ListUserGroupsResponse, error)
CreateUserGroup(context.Context, *CreateUserGroupRequest) (*UserGroup, error)
+ // UpdateUserGroup updates the user group.
+ // Users with "bb.userGroups.update" permission on the workspace or the user group owner can access this method.
UpdateUserGroup(context.Context, *UpdateUserGroupRequest) (*UserGroup, error)
DeleteUserGroup(context.Context, *DeleteUserGroupRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedUserGroupServiceServer()
diff --git a/proto/v1/user_group.proto b/proto/v1/user_group.proto
index d6879b2a70..4174df3513 100644
--- a/proto/v1/user_group.proto
+++ b/proto/v1/user_group.proto
@@ -38,6 +38,8 @@ service UserGroupService {
option (bytebase.v1.auth_method) = IAM;
}
+ // UpdateUserGroup updates the user group.
+ // Users with "bb.userGroups.update" permission on the workspace or the user group owner can access this method.
rpc UpdateUserGroup(UpdateUserGroupRequest) returns (UserGroup) {
option (google.api.http) = {
patch: "/v1/{group.name=groups/*}"
@@ -45,7 +47,7 @@ service UserGroupService {
};
option (google.api.method_signature) = "group,update_mask";
option (bytebase.v1.permission) = "bb.userGroups.update";
- option (bytebase.v1.auth_method) = IAM;
+ option (bytebase.v1.auth_method) = CUSTOM;
}
rpc DeleteUserGroup(DeleteUserGroupRequest) returns (google.protobuf.Empty) {
@@ -132,11 +134,11 @@ message UserGroupMember {
message UserGroup {
option (google.api.resource) = {
type: "bytebase.com/UserGroup"
- pattern: "userGroups/{userGroup}"
+ pattern: "groups/{userGroup}"
};
// The name of the group to retrieve.
- // Format: userGroups/{userGroup}, userGroup is an email.
+ // Format: groups/{userGroup}, userGroup is an email.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
string title = 2;