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: migrate workspace role to iam policy (#12802)
ecmadao4ce1df647d0f
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.goindex f10ae94b87..c25c12eafe 100644--- a/backend/api/v1/auth_service.go+++ b/backend/api/v1/auth_service.go@@ -194,18 +194,11 @@ func (s *AuthService) CreateUser(ctx context.Context, request *v1pb.CreateUserRePasswordHash: string(passwordHash),}- users, err := s.store.ListUsers(ctx, &store.FindUserMessage{})- if err != nil {- return nil, err- }- firstUser := true- for _, user := range users {- if user.ID >= 100 {- firstUser = false- break- }- }- if !firstUser {+ if firstEndUser {+ // The first end user should be workspace admin.+ userMessage.Roles = []api.Role{api.WorkspaceAdmin}+ } else {+ // Otherwise only workspace admin can set roles while creating the user.rolePtr := ctx.Value(common.RoleContextKey)if rolePtr != nil && rolePtr.(api.Role) == api.WorkspaceAdmin {for _, role := range request.User.Roles {@@ -215,15 +208,7 @@ func (s *AuthService) CreateUser(ctx context.Context, request *v1pb.CreateUserRe}userMessage.Roles = append(userMessage.Roles, api.Role(roleID))}- }- }- // If multiple roles are specified, checks if the current user is workspace admin.- if len(userMessage.Roles) > 1 {- user, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)- if !ok {- return nil, status.Error(codes.PermissionDenied, "user not found in context")- }- if !slices.Contains(user.Roles, api.WorkspaceAdmin) {+ } else if len(request.User.Roles) > 0 {return nil, status.Errorf(codes.PermissionDenied, "only workspace owner can create user with multiple roles")}}diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.goindex 08e337eefd..7547acaa8e 100644--- a/backend/api/v1/issue_service.go+++ b/backend/api/v1/issue_service.go@@ -1714,7 +1714,7 @@ func canRequestIssue(issueCreator *store.UserMessage, user *store.UserMessage) breturn issueCreator.ID == user.ID}-func isUserReviewer(ctx context.Context, stores *store.Store, step *storepb.ApprovalStep, user *store.UserMessage, policy *storepb.ProjectIamPolicy) (bool, error) {+func isUserReviewer(ctx context.Context, stores *store.Store, step *storepb.ApprovalStep, user *store.UserMessage, policy *storepb.IamPolicy) (bool, error) {if len(step.Nodes) != 1 {return false, errors.Errorf("expecting one node but got %v", len(step.Nodes))}diff --git a/backend/api/v1/org_policy_service.go b/backend/api/v1/org_policy_service.goindex 0f07e6d431..3b30e3a6c6 100644--- a/backend/api/v1/org_policy_service.go+++ b/backend/api/v1/org_policy_service.go@@ -22,9 +22,6 @@ import (v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")-// defaultWorkspaceResourceID is a placeholder for resource id in workspace level IAM policy.-var defaultWorkspaceResourceID = 1-// OrgPolicyService implements the workspace policy service.type OrgPolicyService struct {v1pb.UnimplementedOrgPolicyServiceServer@@ -208,7 +205,7 @@ func (s *OrgPolicyService) findPolicyMessage(ctx context.Context, policyName strif err != nil {return nil, policyParent, err}- if resourceID == nil {+ if resourceID == nil && resourceType != api.PolicyResourceTypeWorkspace {return nil, policyParent, status.Errorf(codes.InvalidArgument, "resource id for %s must be specific", resourceType)}@@ -234,7 +231,7 @@ func (s *OrgPolicyService) findPolicyMessage(ctx context.Context, policyName strfunc (s *OrgPolicyService) getPolicyResourceTypeAndID(ctx context.Context, requestName string) (api.PolicyResourceType, *int, error) {if requestName == "" {- return api.PolicyResourceTypeWorkspace, &defaultWorkspaceResourceID, nil+ return api.PolicyResourceTypeWorkspace, nil, nil}if strings.HasPrefix(requestName, common.ProjectNamePrefix) {@@ -384,7 +381,7 @@ func (s *OrgPolicyService) createPolicyMessage(ctx context.Context, creatorID inif err != nil {return nil, err}- if resourceID == nil {+ if resourceID == nil && resourceType != api.PolicyResourceTypeWorkspace {return nil, status.Errorf(codes.InvalidArgument, "resource id for %s must be specific", resourceType)}@@ -406,15 +403,19 @@ func (s *OrgPolicyService) createPolicyMessage(ctx context.Context, creatorID inreturn nil, err}- p, err := s.store.CreatePolicyV2(ctx, &store.PolicyMessage{- ResourceUID: *resourceID,+ create := &store.PolicyMessage{ResourceType: resourceType,Payload: payloadStr,Type: policyType,InheritFromParent: policy.InheritFromParent,// Enforce cannot be false while creating a policy.Enforce: true,- }, creatorID)+ }+ if resourceID != nil {+ create.ResourceUID = *resourceID+ }++ p, err := s.store.CreatePolicyV2(ctx, create, creatorID)if err != nil {return nil, status.Errorf(codes.Internal, err.Error())}diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.goindex e95a4499b2..7a38f37c4d 100644--- a/backend/api/v1/project_service.go+++ b/backend/api/v1/project_service.go@@ -406,7 +406,7 @@ func (s *ProjectService) SetIamPolicy(ctx context.Context, request *v1pb.SetIamPResourceUID: project.UID,ResourceType: api.PolicyResourceTypeProject,Payload: string(policyPayload),- Type: api.PolicyTypeProjectIAM,+ Type: api.PolicyTypeIAM,InheritFromParent: false,// Enforce cannot be false while creating a policy.Enforce: true,@@ -1352,7 +1352,7 @@ func (s *ProjectService) getProjectMessage(ctx context.Context, name string) (*sreturn project, nil}-func (s *ProjectService) convertToV1IamPolicy(ctx context.Context, iamPolicy *storepb.ProjectIamPolicy) (*v1pb.IamPolicy, error) {+func (s *ProjectService) convertToV1IamPolicy(ctx context.Context, iamPolicy *storepb.IamPolicy) (*v1pb.IamPolicy, error) {var bindings []*v1pb.Bindingfor _, binding := range iamPolicy.Bindings {@@ -1413,7 +1413,7 @@ func (s *ProjectService) convertToV1IamPolicy(ctx context.Context, iamPolicy *st}, nil}-func (s *ProjectService) convertToStoreIamPolicy(ctx context.Context, iamPolicy *v1pb.IamPolicy) (*storepb.ProjectIamPolicy, error) {+func (s *ProjectService) convertToStoreIamPolicy(ctx context.Context, iamPolicy *v1pb.IamPolicy) (*storepb.IamPolicy, error) {var bindings []*storepb.Bindingfor _, binding := range iamPolicy.Bindings {@@ -1450,7 +1450,7 @@ func (s *ProjectService) convertToStoreIamPolicy(ctx context.Context, iamPolicybindings = append(bindings, storeBinding)}- return &storepb.ProjectIamPolicy{+ return &storepb.IamPolicy{Bindings: bindings,}, nil}diff --git a/backend/api/v1/role_service.go b/backend/api/v1/role_service.goindex 133fb48d96..ecfc2d4ab2 100644--- a/backend/api/v1/role_service.go+++ b/backend/api/v1/role_service.go@@ -177,7 +177,7 @@ func (s *RoleService) DeleteRole(ctx context.Context, request *v1pb.DeleteRoleRe// TODO(p0ny): consider using sql for better performance?func (s *RoleService) getProjectUsingRole(ctx context.Context, role string) (bool, int, error) {resourceType := api.PolicyResourceTypeProject- policyType := api.PolicyTypeProjectIAM+ policyType := api.PolicyTypeIAMpolicies, err := s.store.ListPoliciesV2(ctx, &store.FindPolicyMessage{ResourceType: &resourceType,@@ -188,7 +188,7 @@ func (s *RoleService) getProjectUsingRole(ctx context.Context, role string) (boo}for _, policy := range policies {- iamPolicy := &storepb.ProjectIamPolicy{}+ iamPolicy := &storepb.IamPolicy{}if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(policy.Payload), iamPolicy); err != nil {return false, 0, errors.Wrapf(err, "failed to unmarshal iam policy")}diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.goindex c01d95b5ca..6d3fc0edbb 100644--- a/backend/api/v1/sql_service.go+++ b/backend/api/v1/sql_service.go@@ -1080,7 +1080,7 @@ func validateQueryRequest(instance *store.InstanceMessage, statement string) errreturn nil}-func (s *SQLService) hasDatabaseAccessRights(ctx context.Context, user *store.UserMessage, projectPolicy *storepb.ProjectIamPolicy, attributes map[string]any, isExport bool) (bool, error) {+func (s *SQLService) hasDatabaseAccessRights(ctx context.Context, user *store.UserMessage, projectPolicy *storepb.IamPolicy, attributes map[string]any, isExport bool) (bool, error) {wantPermission := iam.PermissionDatabasesQueryif isExport {wantPermission = iam.PermissionDatabasesExportdiff --git a/backend/component/iam/manager.go b/backend/component/iam/manager.goindex 305456a061..6feb85a022 100644--- a/backend/component/iam/manager.go+++ b/backend/component/iam/manager.go@@ -189,7 +189,7 @@ func (m *Manager) getProjectRoles(ctx context.Context, user *store.UserMessage,return roles, nil}-func getRolesFromProjectPolicy(ctx context.Context, stores *store.Store, user *store.UserMessage, policy *storepb.ProjectIamPolicy) []string {+func getRolesFromProjectPolicy(ctx context.Context, stores *store.Store, user *store.UserMessage, policy *storepb.IamPolicy) []string {var roles []stringbindings := utils.GetUserIAMPolicyBindings(ctx, stores, user, policy)diff --git a/backend/legacyapi/policy.go b/backend/legacyapi/policy.goindex d1359b53a2..07237f141d 100644--- a/backend/legacyapi/policy.go+++ b/backend/legacyapi/policy.go@@ -44,8 +44,8 @@ const (PolicyTypeMaskingRule PolicyType = "bb.policy.masking-rule"// PolicyTypeRestrictIssueCreationForSQLReview is the policy type for restricting issue creation for SQL review.PolicyTypeRestrictIssueCreationForSQLReview PolicyType = "bb.policy.restrict-issue-creation-for-sql-review"- // PolicyTypeProjectIAM is the policy for IAM in the project.- PolicyTypeProjectIAM PolicyType = "bb.policy.project-iam"+ // PolicyTypeIAM is the policy for IAM.+ PolicyTypeIAM PolicyType = "bb.policy.iam"// PolicyTypeTag is the policy type for resource tags.PolicyTypeTag PolicyType = "bb.policy.tag"@@ -93,6 +93,7 @@ var (PolicyTypeMaskingRule: {PolicyResourceTypeWorkspace},PolicyTypeMaskingException: {PolicyResourceTypeProject},PolicyTypeRestrictIssueCreationForSQLReview: {PolicyResourceTypeWorkspace, PolicyResourceTypeProject},+ PolicyTypeIAM: {PolicyResourceTypeWorkspace},})diff --git a/backend/migrator/migration/prod/2.22/0000##update_policy.sql b/backend/migrator/migration/prod/2.22/0000##update_policy.sqlnew file mode 100644index 0000000000..bf9e0e7e6b--- /dev/null+++ b/backend/migrator/migration/prod/2.22/0000##update_policy.sql@@ -0,0 +1,7 @@+UPDATE policy+SET type = 'bb.policy.iam'+WHERE type = 'bb.policy.project-iam';++UPDATE policy+SET resource_id = 0+WHERE resource_type = 'WORKSPACE';\ No newline at end of filediff --git a/backend/migrator/migration/prod/2.22/0001##workspace_iam_policy.sql b/backend/migrator/migration/prod/2.22/0001##workspace_iam_policy.sqlnew file mode 100644index 0000000000..27e272ad7c--- /dev/null+++ b/backend/migrator/migration/prod/2.22/0001##workspace_iam_policy.sql@@ -0,0 +1,34 @@+INSERT INTO policy+(+ creator_id,+ updater_id,+ type,+ payload,+ resource_type,+ resource_id,+ inherit_from_parent+)+SELECT+ 1,+ 1,+ 'bb.policy.iam',+ jsonb_build_object('bindings', jsonb_agg(t2.binding) || '{"role": "roles/workspaceMember", "members": ["allUsers"]}'::jsonb),+ 'WORKSPACE',+ 0,+ FALSE+FROM+(+ SELECT+ 'roles/'||role AS role,+ array_agg('users/' || principal_id) AS members+ FROM member+ WHERE role != 'workspaceMember'+ GROUP BY role+) t1+LEFT JOIN LATERAL (+ SELECT+ jsonb_build_object(+ 'role', t1.role,+ 'members', t1.members+ ) AS binding+) t2 ON TRUE;diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex 81406a32c0..c8630a81af 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -230,5 +230,5 @@ func TestMigrationCompatibility(t *testing.T) {func TestGetCutoffVersion(t *testing.T) {releaseVersion, err := getProdCutoffVersion()require.NoError(t, err)- require.Equal(t, semver.MustParse("2.21.4"), releaseVersion)+ require.Equal(t, semver.MustParse("2.22.1"), releaseVersion)}diff --git a/backend/store/policy.go b/backend/store/policy.goindex 8f78eccfce..c9502bd6ba 100644--- a/backend/store/policy.go+++ b/backend/store/policy.go@@ -5,10 +5,12 @@ import ("database/sql""fmt""log/slog"+ "slices""strings""time""github.com/pkg/errors"+ "google.golang.org/protobuf/encoding/protojson""github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/common/log"@@ -16,22 +18,136 @@ import (storepb "github.com/bytebase/bytebase/proto/generated-go/store")-func (s *Store) GetProjectIamPolicy(ctx context.Context, projectUID int) (*storepb.ProjectIamPolicy, error) {+func (s *Store) GetWorkspaceIamPolicy(ctx context.Context) (*storepb.IamPolicy, error) {+ resourceType := api.PolicyResourceTypeWorkspace+ return s.getIamPolicy(ctx, &FindPolicyMessage{+ ResourceType: &resourceType,+ })+}++type UpdateIamPolicyMessage struct {+ UserUID int+ Roles []api.Role+ UpdaterUID int+}++// UpdateWorkspaceIamPolicy will set or remove the member for the workspace role.+func (s *Store) UpdateWorkspaceIamPolicy(ctx context.Context, update *UpdateIamPolicyMessage) (*storepb.IamPolicy, error) {+ workspaceIamPolicy, err := s.GetWorkspaceIamPolicy(ctx)+ if err != nil {+ return nil, err+ }++ roleMap := map[string]bool{}+ for _, role := range update.Roles {+ roleMap[common.FormatRole(role.String())] = true+ }++ member := common.FormatUserUID(update.UserUID)++ for _, binding := range workspaceIamPolicy.Bindings {+ index := slices.Index(binding.Members, member)+ if !roleMap[binding.Role] {+ if index >= 0 {+ binding.Members = slices.Delete(binding.Members, index, index+1)+ }+ } else {+ if index < 0 {+ binding.Members = append(binding.Members, member)+ }+ }++ delete(roleMap, binding.Role)+ }++ for role := range roleMap {+ workspaceIamPolicy.Bindings = append(workspaceIamPolicy.Bindings, &storepb.Binding{+ Role: role,+ Members: []string{+ member,+ },+ })+ }++ policyPayload, err := protojson.Marshal(workspaceIamPolicy)+ if err != nil {+ return nil, err+ }++ if _, err := s.CreatePolicyV2(ctx, &PolicyMessage{+ ResourceType: api.PolicyResourceTypeWorkspace,+ Payload: string(policyPayload),+ Type: api.PolicyTypeIAM,+ InheritFromParent: false,+ // Enforce cannot be false while creating a policy.+ Enforce: true,+ }, update.UpdaterUID); err != nil {+ return nil, err+ }++ return s.GetWorkspaceIamPolicy(ctx)+}++func findBindingByRole(policy *storepb.IamPolicy, role api.Role) *storepb.Binding {+ r := common.FormatRole(role.String())+ for _, binding := range policy.Bindings {+ if binding.Role == r {+ return binding+ }+ }+ return &storepb.Binding{+ Role: r,+ }+}++func findRolesByUserID(policy *storepb.IamPolicy, userUID int) []api.Role {+ member := common.FormatUserUID(userUID)+ roles := []api.Role{}+ hasWorkspaceRole := false++ for _, binding := range policy.Bindings {+ roleID, err := common.GetRoleID(binding.Role)+ if err != nil {+ slog.Error("cannot get role id", slog.String("role", binding.Role))+ continue+ }+ if roleID == api.WorkspaceMember.String() {+ continue+ }++ if slices.Contains(binding.Members, api.AllUsers) || slices.Contains(binding.Members, member) {+ if strings.HasPrefix(roleID, "workspace") {+ hasWorkspaceRole = true+ }+ roles = append(roles, api.Role(roleID))+ }+ }+ if !hasWorkspaceRole {+ roles = append(roles, api.WorkspaceMember)+ }+ return roles+}++func (s *Store) GetProjectIamPolicy(ctx context.Context, projectUID int) (*storepb.IamPolicy, error) {resourceType := api.PolicyResourceTypeProject- pType := api.PolicyTypeProjectIAM- policy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{+ return s.getIamPolicy(ctx, &FindPolicyMessage{ResourceType: &resourceType,ResourceUID: &projectUID,- Type: &pType,})+}++func (s *Store) getIamPolicy(ctx context.Context, find *FindPolicyMessage) (*storepb.IamPolicy, error) {+ pType := api.PolicyTypeIAM+ find.Type = &pType+ policy, err := s.GetPolicyV2(ctx, find)if err != nil {return nil, err}if policy == nil {- return &storepb.ProjectIamPolicy{}, nil+ return &storepb.IamPolicy{}, nil}- p := &storepb.ProjectIamPolicy{}+ p := &storepb.IamPolicy{}if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(policy.Payload), p); err != nil {return nil, errors.Wrapf(err, "failed to unmarshal iam policy")}@@ -461,7 +577,8 @@ func upsertPolicyV2Impl(ctx context.Context, tx *Tx, create *PolicyMessage, creainherit_from_parent = EXCLUDED.inherit_from_parent,payload = EXCLUDED.payload,updated_ts = extract(epoch from now()),- row_status = EXCLUDED.row_status+ row_status = EXCLUDED.row_status,+ updater_id = EXCLUDED.updater_idRETURNING id`,creatorID,diff --git a/backend/store/principal.go b/backend/store/principal.goindex 73a2cc5014..cb9293366b 100644--- a/backend/store/principal.go+++ b/backend/store/principal.go@@ -4,10 +4,10 @@ import ("context""fmt""log/slog"+ "slices""strings""time"- "github.com/jackc/pgtype""github.com/pkg/errors""google.golang.org/protobuf/encoding/protojson"@@ -158,7 +158,17 @@ func (s *Store) listAndCacheAllUsers(ctx context.Context) ([]*UserMessage, errorreturn users, nil}-func (*Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) ([]*UserMessage, error) {+func (s *Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) ([]*UserMessage, error) {+ workspaceIamPolicy, err := s.GetWorkspaceIamPolicy(ctx)+ if err != nil {+ return nil, err+ }++ var binding *storepb.Binding+ if v := find.Role; v != nil {+ binding = findBindingByRole(workspaceIamPolicy, *v)+ }+where, args := []string{"TRUE"}, []any{}if v := find.ID; v != nil {where, args = append(where, fmt.Sprintf("principal.id = $%d", len(args)+1)), append(args, *v)@@ -173,9 +183,6 @@ func (*Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) (if v := find.Type; v != nil {where, args = append(where, fmt.Sprintf("principal.type = $%d", len(args)+1)), append(args, *v)}- if v := find.Role; v != nil {- where, args = append(where, fmt.Sprintf("$%d = ANY(member_roles.roles)", len(args)+1)), append(args, *v)- }if !find.ShowDeleted {where, args = append(where, fmt.Sprintf("principal.row_status = $%d", len(args)+1)), append(args, api.Normal)}@@ -189,10 +196,8 @@ func (*Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) (principal.type,principal.password_hash,principal.mfa_config,- principal.phone,- member_roles.roles+ principal.phoneFROM principal- LEFT JOIN LATERAL (SELECT ARRAY(SELECT member.role FROM member WHERE member.principal_id = principal.id ORDER BY member.role)) AS member_roles(roles) ON TRUEWHERE ` + strings.Join(where, " AND ")if v := find.Limit; v != nil {@@ -207,7 +212,6 @@ func (*Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) (defer rows.Close()for rows.Next() {var userMessage UserMessage- var roles pgtype.TextArrayvar rowStatus stringvar mfaConfigBytes []byteif err := rows.Scan(@@ -219,25 +223,20 @@ func (*Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) (&userMessage.PasswordHash,&mfaConfigBytes,&userMessage.Phone,- &roles,); err != nil {return nil, err}- // pgtype cannot assign []string to []api.Role- var rolesString []string- if err := roles.AssignTo(&rolesString); err != nil {- return nil, errors.Wrapf(err, "failed to scan roles")- }- for _, r := range rolesString {- userMessage.Roles = append(userMessage.Roles, api.Role(r))+ if b := binding; b != nil {+ if !slices.Contains(b.Members, common.FormatUserUID(userMessage.ID)) {+ continue+ }}+if userMessage.ID == api.SystemBotID {userMessage.Roles = append(userMessage.Roles, api.WorkspaceAdmin)- }-- if !containsWorkspaceRole(userMessage.Roles) {- userMessage.Roles = append(userMessage.Roles, api.WorkspaceMember)+ } else {+ userMessage.Roles = findRolesByUserID(workspaceIamPolicy, userMessage.ID)}userMessage.MemberDeleted = convertRowStatusToDeleted(rowStatus)@@ -289,38 +288,21 @@ func (s *Store) CreateUser(ctx context.Context, create *UserMessage, creatorID ireturn nil, err}- var count int- if err := tx.QueryRowContext(ctx,- `SELECT COUNT(1) FROM member`,- ).Scan(&count); err != nil {+ if err := tx.Commit(); err != nil {return nil, err}- roles := create.Roles- firstMember := count == 0- // Grant the member Owner role if there is no existing member.- if firstMember {- roles = []api.Role{api.WorkspaceAdmin}- }- roles = uniq(roles)-+ roles := uniq(create.Roles)if len(roles) > 0 {- if _, err := tx.ExecContext(ctx, `- INSERT INTO member (- creator_id,- updater_id,- role,- principal_id- ) SELECT $1, $2, unnest($3::text[]), $4`,- creatorID, creatorID, roles, userID); err != nil {- return nil, errors.Wrapf(err, "failed to insert members")+ if _, err := s.UpdateWorkspaceIamPolicy(ctx, &UpdateIamPolicyMessage{+ UserUID: userID,+ Roles: roles,+ UpdaterUID: creatorID,+ }); err != nil {+ return nil, errors.Wrapf(err, "failed to update user roles")}}- if err := tx.Commit(); err != nil {- return nil, err- }-user := &UserMessage{ID: userID,Email: create.Email,@@ -386,85 +368,33 @@ func (s *Store) UpdateUser(ctx context.Context, currentUser *UserMessage, patchreturn nil, err}- var patchRoles []api.Role- doPatchRoles := false+ if err := tx.Commit(); err != nil {+ return nil, err+ }+// patch.Roles overrides patch.Roleif v := patch.Roles; v != nil {- doPatchRoles = true- patchRoles = *v- }- if doPatchRoles {- if err := s.updateUserRoles(ctx, tx, currentUser.ID, patchRoles, updaterID); err != nil {+ if _, err := s.UpdateWorkspaceIamPolicy(ctx, &UpdateIamPolicyMessage{+ UserUID: currentUser.ID,+ Roles: *v,+ UpdaterUID: updaterID,+ }); err != nil {return nil, errors.Wrapf(err, "failed to update user roles")}}- users, err := s.listUserImpl(ctx, tx, &FindUserMessage{ID: ¤tUser.ID, ShowDeleted: true})+ s.userEmailCache.Remove(currentUser.Email)+ s.userIDCache.Remove(currentUser.ID)+ user, err := s.GetUserByID(ctx, currentUser.ID)if err != nil {return nil, err}- if len(users) != 1 {- return nil, errors.Errorf("failed invalid users, %d users with id %d", len(users), currentUser.ID)- }- user := users[0]- if err := tx.Commit(); err != nil {- return nil, err- }-- s.userEmailCache.Remove(currentUser.Email)s.userIDCache.Add(currentUser.ID, user)s.userEmailCache.Add(user.Email, user)return user, nil}-func (s *Store) updateUserRoles(ctx context.Context, tx *Tx, userUID int, roles []api.Role, updaterUID int) error {- oldUser, err := s.listUserImpl(ctx, tx, &FindUserMessage{ID: &userUID})- if err != nil {- return err- }- if len(oldUser) != 1 {- return errors.Errorf("expect to get one user with uid %d, got %d", userUID, len(oldUser))- }- oldMap, newMap := make(map[api.Role]struct{}), make(map[api.Role]struct{})- for _, r := range oldUser[0].Roles {- oldMap[r] = struct{}{}- }- for _, r := range roles {- newMap[r] = struct{}{}- }- var remove, add []string- for r := range oldMap {- if _, ok := newMap[r]; !ok {- remove = append(remove, r.String())- }- }- for r := range newMap {- if _, ok := oldMap[r]; !ok {- add = append(add, r.String())- }- }-- if len(remove) > 0 {- if _, err := tx.ExecContext(ctx, `- DELETE FROM member- WHERE principal_id = $1 AND role = ANY($2)- `, userUID, remove); err != nil {- return err- }- }- if len(add) > 0 {- if _, err := tx.ExecContext(ctx, `- INSERT INTO member (principal_id, role, creator_id, updater_id)- SELECT $1, unnest($2::text[]), $3, $3- `, userUID, add, updaterUID); err != nil {- return err- }- }-- return nil-}-func uniq[T comparable](array []T) []T {res := make([]T, 0, len(array))seen := make(map[T]struct{}, len(array))@@ -479,12 +409,3 @@ func uniq[T comparable](array []T) []T {return res}--func containsWorkspaceRole(roles []api.Role) bool {- for _, role := range roles {- if strings.HasPrefix(role.String(), "workspace") {- return true- }- }- return false-}diff --git a/backend/store/project.go b/backend/store/project.goindex 1107790301..7be8bea7c7 100644--- a/backend/store/project.go+++ b/backend/store/project.go@@ -176,7 +176,7 @@ func (s *Store) CreateProjectV2(ctx context.Context, create *ProjectMessage, crereturn nil, err}- policy := &storepb.ProjectIamPolicy{+ policy := &storepb.IamPolicy{Bindings: []*storepb.Binding{{Role: common.FormatRole(api.ProjectOwner.String()),@@ -195,7 +195,7 @@ func (s *Store) CreateProjectV2(ctx context.Context, create *ProjectMessage, creResourceUID: project.UID,ResourceType: api.PolicyResourceTypeProject,Payload: string(policyPayload),- Type: api.PolicyTypeProjectIAM,+ Type: api.PolicyTypeIAM,InheritFromParent: false,// Enforce cannot be false while creating a policy.Enforce: true,diff --git a/backend/utils/member.go b/backend/utils/member.goindex 7cad3b1486..7a1b2d798d 100644--- a/backend/utils/member.go+++ b/backend/utils/member.go@@ -23,7 +23,7 @@ func validateIAMBinding(binding *storepb.Binding) bool {}// GetUsersByRoleInIAMPolicy gets users in the iam policy.-func GetUsersByRoleInIAMPolicy(ctx context.Context, stores *store.Store, role api.Role, policy *storepb.ProjectIamPolicy) []*store.UserMessage {+func GetUsersByRoleInIAMPolicy(ctx context.Context, stores *store.Store, role api.Role, policy *storepb.IamPolicy) []*store.UserMessage {roleFullName := common.FormatRole(role.String())var users []*store.UserMessage@@ -107,7 +107,7 @@ func getUserByIdentifier(ctx context.Context, stores *store.Store, identifier st}// GetUserIAMPolicyBindings return the valid bindings for the user.-func GetUserIAMPolicyBindings(ctx context.Context, stores *store.Store, user *store.UserMessage, policy *storepb.ProjectIamPolicy) []*storepb.Binding {+func GetUserIAMPolicyBindings(ctx context.Context, stores *store.Store, user *store.UserMessage, policy *storepb.IamPolicy) []*storepb.Binding {userIDFullName := common.FormatUserUID(user.ID)var bindings []*storepb.Binding@@ -159,7 +159,7 @@ func GetUserIAMPolicyBindings(ctx context.Context, stores *store.Store, user *st// getUserRoles returns the `uniq`ed roles of a user, including workspace roles and the roles in the projects.// the condition of role binding is respected and evaluated with request.time=time.Now().// the returned role name should in the roles/{id} format.-func getUserRoles(ctx context.Context, stores *store.Store, user *store.UserMessage, projectPolicies ...*storepb.ProjectIamPolicy) ([]string, error) {+func getUserRoles(ctx context.Context, stores *store.Store, user *store.UserMessage, projectPolicies ...*storepb.IamPolicy) ([]string, error) {var roles []stringfor _, userRole := range user.Roles {roles = append(roles, common.FormatRole(userRole.String()))@@ -177,7 +177,7 @@ func getUserRoles(ctx context.Context, stores *store.Store, user *store.UserMess}// See GetUserRoles.-func GetUserRolesMap(ctx context.Context, stores *store.Store, user *store.UserMessage, projectPolicies ...*storepb.ProjectIamPolicy) (map[api.Role]bool, error) {+func GetUserRolesMap(ctx context.Context, stores *store.Store, user *store.UserMessage, projectPolicies ...*storepb.IamPolicy) (map[api.Role]bool, error) {roles, err := getUserRoles(ctx, stores, user, projectPolicies...)if err != nil {return nil, err@@ -191,7 +191,7 @@ func GetUserRolesMap(ctx context.Context, stores *store.Store, user *store.UserM}// See GetUserRoles. The returned map key format is roles/{role}.-func GetUserFormattedRolesMap(ctx context.Context, stores *store.Store, user *store.UserMessage, projectPolicies ...*storepb.ProjectIamPolicy) (map[string]bool, error) {+func GetUserFormattedRolesMap(ctx context.Context, stores *store.Store, user *store.UserMessage, projectPolicies ...*storepb.IamPolicy) (map[string]bool, error) {roles, err := getUserRoles(ctx, stores, user, projectPolicies...)if err != nil {return nil, errdiff --git a/backend/utils/utils.go b/backend/utils/utils.goindex 759abe2a5c..c37b26cc49 100644--- a/backend/utils/utils.go+++ b/backend/utils/utils.go@@ -601,7 +601,7 @@ func UpdateProjectPolicyFromGrantIssue(ctx context.Context, stores *store.Store,ResourceUID: issue.Project.UID,ResourceType: api.PolicyResourceTypeProject,Payload: string(policyPayload),- Type: api.PolicyTypeProjectIAM,+ Type: api.PolicyTypeIAM,InheritFromParent: false,// Enforce cannot be false while creating a policy.Enforce: true,diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 680c39fd9e..4f18b241b6 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -3629,4 +3629,4 @@"self": "最后更新"}}-}+}\ No newline at end of filediff --git a/frontend/src/types/proto/store/policy.ts b/frontend/src/types/proto/store/policy.tsindex 7f5b96026c..6d6b0eb8ba 100644--- a/frontend/src/types/proto/store/policy.ts+++ b/frontend/src/types/proto/store/policy.ts@@ -211,6 +211,34 @@ export interface TagPolicy_TagsEntry {value: string;}+export interface Binding {+ /**+ * The role that is assigned to the members.+ * Format: roles/{role}+ */+ role: string;+ /**+ * Specifies the principals requesting access for a Bytebase resource.+ * For users, the member should be: users/{userUID}+ * For groups, the member should be: groups/{email}+ */+ members: string[];+ /**+ * The condition that is associated with this binding.+ * If the condition evaluates to true, then this binding applies to the current request.+ * If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.+ */+ condition: Expr | undefined;+}++export interface IamPolicy {+ /**+ * Collection of binding.+ * A binding binds one or more members or groups to a single role.+ */+ bindings: Binding[];+}+function createBaseRolloutPolicy(): RolloutPolicy {return { automatic: false, workspaceRoles: [], projectRoles: [], issueRoles: [] };}@@ -1135,6 +1163,156 @@ export const TagPolicy_TagsEntry = {},};+function createBaseBinding(): Binding {+ return { role: "", members: [], condition: undefined };+}++export const Binding = {+ encode(message: Binding, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.role !== "") {+ writer.uint32(10).string(message.role);+ }+ for (const v of message.members) {+ writer.uint32(18).string(v!);+ }+ if (message.condition !== undefined) {+ Expr.encode(message.condition, writer.uint32(26).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): Binding {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseBinding();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.role = reader.string();+ continue;+ case 2:+ if (tag !== 18) {+ break;+ }++ message.members.push(reader.string());+ continue;+ case 3:+ if (tag !== 26) {+ break;+ }++ message.condition = Expr.decode(reader, reader.uint32());+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): Binding {+ return {+ role: isSet(object.role) ? globalThis.String(object.role) : "",+ members: globalThis.Array.isArray(object?.members) ? object.members.map((e: any) => globalThis.String(e)) : [],+ condition: isSet(object.condition) ? Expr.fromJSON(object.condition) : undefined,+ };+ },++ toJSON(message: Binding): unknown {+ const obj: any = {};+ if (message.role !== "") {+ obj.role = message.role;+ }+ if (message.members?.length) {+ obj.members = message.members;+ }+ if (message.condition !== undefined) {+ obj.condition = Expr.toJSON(message.condition);+ }+ return obj;+ },++ create(base?: DeepPartial<Binding>): Binding {+ return Binding.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<Binding>): Binding {+ const message = createBaseBinding();+ message.role = object.role ?? "";+ message.members = object.members?.map((e) => e) || [];+ message.condition = (object.condition !== undefined && object.condition !== null)+ ? Expr.fromPartial(object.condition)+ : undefined;+ return message;+ },+};++function createBaseIamPolicy(): IamPolicy {+ return { bindings: [] };+}++export const IamPolicy = {+ encode(message: IamPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ for (const v of message.bindings) {+ Binding.encode(v!, writer.uint32(10).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): IamPolicy {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseIamPolicy();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.bindings.push(Binding.decode(reader, reader.uint32()));+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): IamPolicy {+ return {+ bindings: globalThis.Array.isArray(object?.bindings) ? object.bindings.map((e: any) => Binding.fromJSON(e)) : [],+ };+ },++ toJSON(message: IamPolicy): unknown {+ const obj: any = {};+ if (message.bindings?.length) {+ obj.bindings = message.bindings.map((e) => Binding.toJSON(e));+ }+ return obj;+ },++ create(base?: DeepPartial<IamPolicy>): IamPolicy {+ return IamPolicy.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<IamPolicy>): IamPolicy {+ const message = createBaseIamPolicy();+ message.bindings = object.bindings?.map((e) => Binding.fromPartial(e)) || [];+ return message;+ },+};+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;export type DeepPartial<T> = T extends Builtin ? Tdiff --git a/frontend/src/types/proto/store/project.ts b/frontend/src/types/proto/store/project.tsindex 047a66d610..39c1c8a8df 100644--- a/frontend/src/types/proto/store/project.ts+++ b/frontend/src/types/proto/store/project.ts@@ -1,7 +1,6 @@/* eslint-disable */import Long from "long";import _m0 from "protobufjs/minimal";-import { Expr } from "../google/type/expr";export const protobufPackage = "bytebase.store";@@ -135,34 +134,6 @@ export function protectionRule_BranchSourceToNumber(object: ProtectionRule_Branc}}-export interface Binding {- /**- * The role that is assigned to the members.- * Format: roles/{role}- */- role: string;- /**- * Specifies the principals requesting access for a Bytebase resource.- * For users, the member should be: users/{userUID}- * For groups, the member should be: groups/{email}- */- members: string[];- /**- * The condition that is associated with this binding.- * If the condition evaluates to true, then this binding applies to the current request.- * If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.- */- condition: Expr | undefined;-}--export interface ProjectIamPolicy {- /**- * Collection of binding.- * A binding binds one or more members or groups to a single project role.- */- bindings: Binding[];-}-function createBaseLabel(): Label {return { value: "", color: "", group: "" };}@@ -514,156 +485,6 @@ export const ProtectionRule = {},};-function createBaseBinding(): Binding {- return { role: "", members: [], condition: undefined };-}--export const Binding = {- encode(message: Binding, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- if (message.role !== "") {- writer.uint32(10).string(message.role);- }- for (const v of message.members) {- writer.uint32(18).string(v!);- }- if (message.condition !== undefined) {- Expr.encode(message.condition, writer.uint32(26).fork()).ldelim();- }- return writer;- },-- decode(input: _m0.Reader | Uint8Array, length?: number): Binding {- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseBinding();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1:- if (tag !== 10) {- break;- }-- message.role = reader.string();- continue;- case 2:- if (tag !== 18) {- break;- }-- message.members.push(reader.string());- continue;- case 3:- if (tag !== 26) {- break;- }-- message.condition = Expr.decode(reader, reader.uint32());- continue;- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skipType(tag & 7);- }- return message;- },-- fromJSON(object: any): Binding {- return {- role: isSet(object.role) ? globalThis.String(object.role) : "",- members: globalThis.Array.isArray(object?.members) ? object.members.map((e: any) => globalThis.String(e)) : [],- condition: isSet(object.condition) ? Expr.fromJSON(object.condition) : undefined,- };- },-- toJSON(message: Binding): unknown {- const obj: any = {};- if (message.role !== "") {- obj.role = message.role;- }- if (message.members?.length) {- obj.members = message.members;- }- if (message.condition !== undefined) {- obj.condition = Expr.toJSON(message.condition);- }- return obj;- },-- create(base?: DeepPartial<Binding>): Binding {- return Binding.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<Binding>): Binding {- const message = createBaseBinding();- message.role = object.role ?? "";- message.members = object.members?.map((e) => e) || [];- message.condition = (object.condition !== undefined && object.condition !== null)- ? Expr.fromPartial(object.condition)- : undefined;- return message;- },-};--function createBaseProjectIamPolicy(): ProjectIamPolicy {- return { bindings: [] };-}--export const ProjectIamPolicy = {- encode(message: ProjectIamPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- for (const v of message.bindings) {- Binding.encode(v!, writer.uint32(10).fork()).ldelim();- }- return writer;- },-- decode(input: _m0.Reader | Uint8Array, length?: number): ProjectIamPolicy {- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseProjectIamPolicy();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1:- if (tag !== 10) {- break;- }-- message.bindings.push(Binding.decode(reader, reader.uint32()));- continue;- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skipType(tag & 7);- }- return message;- },-- fromJSON(object: any): ProjectIamPolicy {- return {- bindings: globalThis.Array.isArray(object?.bindings) ? object.bindings.map((e: any) => Binding.fromJSON(e)) : [],- };- },-- toJSON(message: ProjectIamPolicy): unknown {- const obj: any = {};- if (message.bindings?.length) {- obj.bindings = message.bindings.map((e) => Binding.toJSON(e));- }- return obj;- },-- create(base?: DeepPartial<ProjectIamPolicy>): ProjectIamPolicy {- return ProjectIamPolicy.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<ProjectIamPolicy>): ProjectIamPolicy {- const message = createBaseProjectIamPolicy();- message.bindings = object.bindings?.map((e) => Binding.fromPartial(e)) || [];- return message;- },-};-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;export type DeepPartial<T> = T extends Builtin ? Tdiff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 0612ac2ae4..dd5fc79d28 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -10171,7 +10171,7 @@ components:$ref: '#/components/schemas/Binding'description: |-Collection of binding.- A binding binds one or more project members to a single project role.+ A binding binds one or more members or groups to a single role.IdentityProvider:type: objectproperties:diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex 98a1c95c4e..305e25fdc3 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -171,6 +171,8 @@- [PlanCheckRunResult.Result.Status](#bytebase-store-PlanCheckRunResult-Result-Status)- [store/policy.proto](#store_policy-proto)+ - [Binding](#bytebase-store-Binding)+ - [IamPolicy](#bytebase-store-IamPolicy)- [MaskData](#bytebase-store-MaskData)- [MaskingExceptionPolicy](#bytebase-store-MaskingExceptionPolicy)- [MaskingExceptionPolicy.MaskingException](#bytebase-store-MaskingExceptionPolicy-MaskingException)@@ -186,10 +188,8 @@- [SQLReviewRuleLevel](#bytebase-store-SQLReviewRuleLevel)- [store/project.proto](#store_project-proto)- - [Binding](#bytebase-store-Binding)- [Label](#bytebase-store-Label)- [Project](#bytebase-store-Project)- - [ProjectIamPolicy](#bytebase-store-ProjectIamPolicy)- [ProtectionRule](#bytebase-store-ProtectionRule)- [ProtectionRule.BranchSource](#bytebase-store-ProtectionRule-BranchSource)@@ -2741,6 +2741,38 @@ Type is the database change type.+<a name="bytebase-store-Binding"></a>++### Binding++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| role | [string](#string) | | The role that is assigned to the members. Format: roles/{role} |+| members | [string](#string) | repeated | Specifies the principals requesting access for a Bytebase resource. For users, the member should be: users/{userUID} For groups, the member should be: groups/{email} |+| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this binding. If the condition evaluates to true, then this binding applies to the current request. If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. |+++++++<a name="bytebase-store-IamPolicy"></a>++### IamPolicy++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| bindings | [Binding](#bytebase-store-Binding) | repeated | Collection of binding. A binding binds one or more members or groups to a single role. |++++++<a name="bytebase-store-MaskData"></a>### MaskData@@ -2954,23 +2986,6 @@ Format: users/{userUID} or groups/{group email} |-<a name="bytebase-store-Binding"></a>--### Binding----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| role | [string](#string) | | The role that is assigned to the members. Format: roles/{role} |-| members | [string](#string) | repeated | Specifies the principals requesting access for a Bytebase resource. For users, the member should be: users/{userUID} For groups, the member should be: groups/{email} |-| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this binding. If the condition evaluates to true, then this binding applies to the current request. If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. |------<a name="bytebase-store-Label"></a>### Label@@ -3007,21 +3022,6 @@ Format: users/{userUID} or groups/{group email} |-<a name="bytebase-store-ProjectIamPolicy"></a>--### ProjectIamPolicy----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| bindings | [Binding](#bytebase-store-Binding) | repeated | Collection of binding. A binding binds one or more members or groups to a single project role. |------<a name="bytebase-store-ProtectionRule"></a>### ProtectionRulediff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex d447e2d8ef..03bc5f0f5c 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -857,6 +857,14 @@<a href="#store%2fpolicy.proto">store/policy.proto</a><ul>+ <li>+ <a href="#bytebase.store.Binding"><span class="badge">M</span>Binding</a>+ </li>++ <li>+ <a href="#bytebase.store.IamPolicy"><span class="badge">M</span>IamPolicy</a>+ </li>+<li><a href="#bytebase.store.MaskData"><span class="badge">M</span>MaskData</a></li>@@ -916,10 +924,6 @@<a href="#store%2fproject.proto">store/project.proto</a><ul>- <li>- <a href="#bytebase.store.Binding"><span class="badge">M</span>Binding</a>- </li>-<li><a href="#bytebase.store.Label"><span class="badge">M</span>Label</a></li>@@ -928,10 +932,6 @@<a href="#bytebase.store.Project"><span class="badge">M</span>Project</a></li>- <li>- <a href="#bytebase.store.ProjectIamPolicy"><span class="badge">M</span>ProjectIamPolicy</a>- </li>-<li><a href="#bytebase.store.ProtectionRule"><span class="badge">M</span>ProtectionRule</a></li>@@ -7244,6 +7244,74 @@ To supersede `line` and `column` above. </p></td><p></p>+ <h3 id="bytebase.store.Binding">Binding</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>role</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The role that is assigned to the members.+Format: roles/{role} </p></td>+ </tr>++ <tr>+ <td>members</td>+ <td><a href="#string">string</a></td>+ <td>repeated</td>+ <td><p>Specifies the principals requesting access for a Bytebase resource.+For users, the member should be: users/{userUID}+For groups, the member should be: groups/{email} </p></td>+ </tr>++ <tr>+ <td>condition</td>+ <td><a href="#google.type.Expr">google.type.Expr</a></td>+ <td></td>+ <td><p>The condition that is associated with this binding.+If the condition evaluates to true, then this binding applies to the current request.+If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.store.IamPolicy">IamPolicy</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>bindings</td>+ <td><a href="#bytebase.store.Binding">Binding</a></td>+ <td>repeated</td>+ <td><p>Collection of binding.+A binding binds one or more members or groups to a single role. </p></td>+ </tr>++ </tbody>+ </table>+++++<h3 id="bytebase.store.MaskData">MaskData</h3><p></p>@@ -7692,49 +7760,6 @@ for example, the environment resource can have the sql review config tag, like &<p></p>- <h3 id="bytebase.store.Binding">Binding</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>role</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The role that is assigned to the members.-Format: roles/{role} </p></td>- </tr>-- <tr>- <td>members</td>- <td><a href="#string">string</a></td>- <td>repeated</td>- <td><p>Specifies the principals requesting access for a Bytebase resource.-For users, the member should be: users/{userUID}-For groups, the member should be: groups/{email} </p></td>- </tr>-- <tr>- <td>condition</td>- <td><a href="#google.type.Expr">google.type.Expr</a></td>- <td></td>- <td><p>The condition that is associated with this binding.-If the condition evaluates to true, then this binding applies to the current request.-If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. </p></td>- </tr>-- </tbody>- </table>-----<h3 id="bytebase.store.Label">Label</h3><p></p>@@ -7825,31 +7850,6 @@ If the condition evaluates to false, then this binding does not apply to the cur- <h3 id="bytebase.store.ProjectIamPolicy">ProjectIamPolicy</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>bindings</td>- <td><a href="#bytebase.store.Binding">Binding</a></td>- <td>repeated</td>- <td><p>Collection of binding.-A binding binds one or more members or groups to a single project role. </p></td>- </tr>-- </tbody>- </table>-----<h3 id="bytebase.store.ProtectionRule">ProtectionRule</h3><p></p>diff --git a/proto/generated-go/store/policy.pb.go b/proto/generated-go/store/policy.pb.goindex 54123ae189..c9e69902c0 100644--- a/proto/generated-go/store/policy.pb.go+++ b/proto/generated-go/store/policy.pb.go@@ -552,6 +552,126 @@ func (x *TagPolicy) GetTags() map[string]string {return nil}+type Binding struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The role that is assigned to the members.+ // Format: roles/{role}+ Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`+ // Specifies the principals requesting access for a Bytebase resource.+ // For users, the member should be: users/{userUID}+ // For groups, the member should be: groups/{email}+ Members []string `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"`+ // The condition that is associated with this binding.+ // If the condition evaluates to true, then this binding applies to the current request.+ // If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.+ Condition *expr.Expr `protobuf:"bytes,3,opt,name=condition,proto3" json:"condition,omitempty"`+}++func (x *Binding) Reset() {+ *x = Binding{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_policy_proto_msgTypes[7]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *Binding) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*Binding) ProtoMessage() {}++func (x *Binding) ProtoReflect() protoreflect.Message {+ mi := &file_store_policy_proto_msgTypes[7]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use Binding.ProtoReflect.Descriptor instead.+func (*Binding) Descriptor() ([]byte, []int) {+ return file_store_policy_proto_rawDescGZIP(), []int{7}+}++func (x *Binding) GetRole() string {+ if x != nil {+ return x.Role+ }+ return ""+}++func (x *Binding) GetMembers() []string {+ if x != nil {+ return x.Members+ }+ return nil+}++func (x *Binding) GetCondition() *expr.Expr {+ if x != nil {+ return x.Condition+ }+ return nil+}++type IamPolicy struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // Collection of binding.+ // A binding binds one or more members or groups to a single role.+ Bindings []*Binding `protobuf:"bytes,1,rep,name=bindings,proto3" json:"bindings,omitempty"`+}++func (x *IamPolicy) Reset() {+ *x = IamPolicy{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_policy_proto_msgTypes[8]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *IamPolicy) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*IamPolicy) ProtoMessage() {}++func (x *IamPolicy) ProtoReflect() protoreflect.Message {+ mi := &file_store_policy_proto_msgTypes[8]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use IamPolicy.ProtoReflect.Descriptor instead.+func (*IamPolicy) Descriptor() ([]byte, []int) {+ return file_store_policy_proto_rawDescGZIP(), []int{8}+}++func (x *IamPolicy) GetBindings() []*Binding {+ if x != nil {+ return x.Bindings+ }+ return nil+}+type MaskingExceptionPolicy_MaskingException struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -572,7 +692,7 @@ type MaskingExceptionPolicy_MaskingException struct {func (x *MaskingExceptionPolicy_MaskingException) Reset() {*x = MaskingExceptionPolicy_MaskingException{}if protoimpl.UnsafeEnabled {- mi := &file_store_policy_proto_msgTypes[7]+ mi := &file_store_policy_proto_msgTypes[9]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -585,7 +705,7 @@ func (x *MaskingExceptionPolicy_MaskingException) String() string {func (*MaskingExceptionPolicy_MaskingException) ProtoMessage() {}func (x *MaskingExceptionPolicy_MaskingException) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[7]+ mi := &file_store_policy_proto_msgTypes[9]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -643,7 +763,7 @@ type MaskingRulePolicy_MaskingRule struct {func (x *MaskingRulePolicy_MaskingRule) Reset() {*x = MaskingRulePolicy_MaskingRule{}if protoimpl.UnsafeEnabled {- mi := &file_store_policy_proto_msgTypes[8]+ mi := &file_store_policy_proto_msgTypes[10]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -656,7 +776,7 @@ func (x *MaskingRulePolicy_MaskingRule) String() string {func (*MaskingRulePolicy_MaskingRule) ProtoMessage() {}func (x *MaskingRulePolicy_MaskingRule) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[8]+ mi := &file_store_policy_proto_msgTypes[10]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -795,14 +915,24 @@ var file_store_policy_proto_rawDesc = []byte{0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,- 0x2a, 0x51, 0x0a, 0x12, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x75, 0x6c,- 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f,- 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a,- 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e,- 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x41, 0x42, 0x4c, 0x45,- 0x44, 0x10, 0x03, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64,- 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,- 0x33,+ 0x22, 0x68, 0x0a, 0x07, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x72,+ 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12,+ 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09,+ 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x2f, 0x0a, 0x09, 0x63, 0x6f, 0x6e,+ 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67,+ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52,+ 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x40, 0x0a, 0x09, 0x49, 0x61,+ 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x33, 0x0a, 0x08, 0x62, 0x69, 0x6e, 0x64, 0x69,+ 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x64, 0x69,+ 0x6e, 0x67, 0x52, 0x08, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2a, 0x51, 0x0a, 0x12,+ 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x4c, 0x65, 0x76,+ 0x65, 0x6c, 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x55, 0x4e, 0x53, 0x50,+ 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52,+ 0x4f, 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10,+ 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x41, 0x42, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x42,+ 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f,+ 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (@@ -818,7 +948,7 @@ func file_store_policy_proto_rawDescGZIP() []byte {}var file_store_policy_proto_enumTypes = make([]protoimpl.EnumInfo, 2)-var file_store_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 10)+var file_store_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 12)var file_store_policy_proto_goTypes = []any{(SQLReviewRuleLevel)(0), // 0: bytebase.store.SQLReviewRuleLevel(MaskingExceptionPolicy_MaskingException_Action)(0), // 1: bytebase.store.MaskingExceptionPolicy.MaskingException.Action@@ -829,31 +959,35 @@ var file_store_policy_proto_goTypes = []any{(*MaskingRulePolicy)(nil), // 6: bytebase.store.MaskingRulePolicy(*SQLReviewRule)(nil), // 7: bytebase.store.SQLReviewRule(*TagPolicy)(nil), // 8: bytebase.store.TagPolicy- (*MaskingExceptionPolicy_MaskingException)(nil), // 9: bytebase.store.MaskingExceptionPolicy.MaskingException- (*MaskingRulePolicy_MaskingRule)(nil), // 10: bytebase.store.MaskingRulePolicy.MaskingRule- nil, // 11: bytebase.store.TagPolicy.TagsEntry- (MaskingLevel)(0), // 12: bytebase.store.MaskingLevel- (Engine)(0), // 13: bytebase.store.Engine- (*expr.Expr)(nil), // 14: google.type.Expr+ (*Binding)(nil), // 9: bytebase.store.Binding+ (*IamPolicy)(nil), // 10: bytebase.store.IamPolicy+ (*MaskingExceptionPolicy_MaskingException)(nil), // 11: bytebase.store.MaskingExceptionPolicy.MaskingException+ (*MaskingRulePolicy_MaskingRule)(nil), // 12: bytebase.store.MaskingRulePolicy.MaskingRule+ nil, // 13: bytebase.store.TagPolicy.TagsEntry+ (MaskingLevel)(0), // 14: bytebase.store.MaskingLevel+ (Engine)(0), // 15: bytebase.store.Engine+ (*expr.Expr)(nil), // 16: google.type.Expr}var file_store_policy_proto_depIdxs = []int32{4, // 0: bytebase.store.MaskingPolicy.mask_data:type_name -> bytebase.store.MaskData- 12, // 1: bytebase.store.MaskData.masking_level:type_name -> bytebase.store.MaskingLevel- 9, // 2: bytebase.store.MaskingExceptionPolicy.masking_exceptions:type_name -> bytebase.store.MaskingExceptionPolicy.MaskingException- 10, // 3: bytebase.store.MaskingRulePolicy.rules:type_name -> bytebase.store.MaskingRulePolicy.MaskingRule+ 14, // 1: bytebase.store.MaskData.masking_level:type_name -> bytebase.store.MaskingLevel+ 11, // 2: bytebase.store.MaskingExceptionPolicy.masking_exceptions:type_name -> bytebase.store.MaskingExceptionPolicy.MaskingException+ 12, // 3: bytebase.store.MaskingRulePolicy.rules:type_name -> bytebase.store.MaskingRulePolicy.MaskingRule0, // 4: bytebase.store.SQLReviewRule.level:type_name -> bytebase.store.SQLReviewRuleLevel- 13, // 5: bytebase.store.SQLReviewRule.engine:type_name -> bytebase.store.Engine- 11, // 6: bytebase.store.TagPolicy.tags:type_name -> bytebase.store.TagPolicy.TagsEntry- 1, // 7: bytebase.store.MaskingExceptionPolicy.MaskingException.action:type_name -> bytebase.store.MaskingExceptionPolicy.MaskingException.Action- 12, // 8: bytebase.store.MaskingExceptionPolicy.MaskingException.masking_level:type_name -> bytebase.store.MaskingLevel- 14, // 9: bytebase.store.MaskingExceptionPolicy.MaskingException.condition:type_name -> google.type.Expr- 14, // 10: bytebase.store.MaskingRulePolicy.MaskingRule.condition:type_name -> google.type.Expr- 12, // 11: bytebase.store.MaskingRulePolicy.MaskingRule.masking_level:type_name -> bytebase.store.MaskingLevel- 12, // [12:12] is the sub-list for method output_type- 12, // [12:12] is the sub-list for method input_type- 12, // [12:12] is the sub-list for extension type_name- 12, // [12:12] is the sub-list for extension extendee- 0, // [0:12] is the sub-list for field type_name+ 15, // 5: bytebase.store.SQLReviewRule.engine:type_name -> bytebase.store.Engine+ 13, // 6: bytebase.store.TagPolicy.tags:type_name -> bytebase.store.TagPolicy.TagsEntry+ 16, // 7: bytebase.store.Binding.condition:type_name -> google.type.Expr+ 9, // 8: bytebase.store.IamPolicy.bindings:type_name -> bytebase.store.Binding+ 1, // 9: bytebase.store.MaskingExceptionPolicy.MaskingException.action:type_name -> bytebase.store.MaskingExceptionPolicy.MaskingException.Action+ 14, // 10: bytebase.store.MaskingExceptionPolicy.MaskingException.masking_level:type_name -> bytebase.store.MaskingLevel+ 16, // 11: bytebase.store.MaskingExceptionPolicy.MaskingException.condition:type_name -> google.type.Expr+ 16, // 12: bytebase.store.MaskingRulePolicy.MaskingRule.condition:type_name -> google.type.Expr+ 14, // 13: bytebase.store.MaskingRulePolicy.MaskingRule.masking_level:type_name -> bytebase.store.MaskingLevel+ 14, // [14:14] is the sub-list for method output_type+ 14, // [14:14] is the sub-list for method input_type+ 14, // [14:14] is the sub-list for extension type_name+ 14, // [14:14] is the sub-list for extension extendee+ 0, // [0:14] is the sub-list for field type_name}func init() { file_store_policy_proto_init() }@@ -948,7 +1082,7 @@ func file_store_policy_proto_init() {}}file_store_policy_proto_msgTypes[7].Exporter = func(v any, i int) any {- switch v := v.(*MaskingExceptionPolicy_MaskingException); i {+ switch v := v.(*Binding); i {case 0:return &v.statecase 1:@@ -960,6 +1094,30 @@ func file_store_policy_proto_init() {}}file_store_policy_proto_msgTypes[8].Exporter = func(v any, i int) any {+ switch v := v.(*IamPolicy); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_store_policy_proto_msgTypes[9].Exporter = func(v any, i int) any {+ switch v := v.(*MaskingExceptionPolicy_MaskingException); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_store_policy_proto_msgTypes[10].Exporter = func(v any, i int) any {switch v := v.(*MaskingRulePolicy_MaskingRule); i {case 0:return &v.state@@ -978,7 +1136,7 @@ func file_store_policy_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_store_policy_proto_rawDesc,NumEnums: 2,- NumMessages: 10,+ NumMessages: 12,NumExtensions: 0,NumServices: 0,},diff --git a/proto/generated-go/store/project.pb.go b/proto/generated-go/store/project.pb.goindex 8c5b191379..930bf467e3 100644--- a/proto/generated-go/store/project.pb.go+++ b/proto/generated-go/store/project.pb.go@@ -7,7 +7,6 @@package storeimport (- expr "google.golang.org/genproto/googleapis/type/expr"protoreflect "google.golang.org/protobuf/reflect/protoreflect"protoimpl "google.golang.org/protobuf/runtime/protoimpl"reflect "reflect"@@ -345,193 +344,61 @@ func (x *ProtectionRule) GetBranchSource() ProtectionRule_BranchSource {return ProtectionRule_BRANCH_SOURCE_UNSPECIFIED}-type Binding struct {- state protoimpl.MessageState- sizeCache protoimpl.SizeCache- unknownFields protoimpl.UnknownFields-- // The role that is assigned to the members.- // Format: roles/{role}- Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`- // Specifies the principals requesting access for a Bytebase resource.- // For users, the member should be: users/{userUID}- // For groups, the member should be: groups/{email}- Members []string `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"`- // The condition that is associated with this binding.- // If the condition evaluates to true, then this binding applies to the current request.- // If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.- Condition *expr.Expr `protobuf:"bytes,3,opt,name=condition,proto3" json:"condition,omitempty"`-}--func (x *Binding) Reset() {- *x = Binding{}- if protoimpl.UnsafeEnabled {- mi := &file_store_project_proto_msgTypes[3]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)- }-}--func (x *Binding) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*Binding) ProtoMessage() {}--func (x *Binding) ProtoReflect() protoreflect.Message {- mi := &file_store_project_proto_msgTypes[3]- if protoimpl.UnsafeEnabled && x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use Binding.ProtoReflect.Descriptor instead.-func (*Binding) Descriptor() ([]byte, []int) {- return file_store_project_proto_rawDescGZIP(), []int{3}-}--func (x *Binding) GetRole() string {- if x != nil {- return x.Role- }- return ""-}--func (x *Binding) GetMembers() []string {- if x != nil {- return x.Members- }- return nil-}--func (x *Binding) GetCondition() *expr.Expr {- if x != nil {- return x.Condition- }- return nil-}--type ProjectIamPolicy struct {- state protoimpl.MessageState- sizeCache protoimpl.SizeCache- unknownFields protoimpl.UnknownFields-- // Collection of binding.- // A binding binds one or more members or groups to a single project role.- Bindings []*Binding `protobuf:"bytes,1,rep,name=bindings,proto3" json:"bindings,omitempty"`-}--func (x *ProjectIamPolicy) Reset() {- *x = ProjectIamPolicy{}- if protoimpl.UnsafeEnabled {- mi := &file_store_project_proto_msgTypes[4]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)- }-}--func (x *ProjectIamPolicy) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ProjectIamPolicy) ProtoMessage() {}--func (x *ProjectIamPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_project_proto_msgTypes[4]- if protoimpl.UnsafeEnabled && x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use ProjectIamPolicy.ProtoReflect.Descriptor instead.-func (*ProjectIamPolicy) Descriptor() ([]byte, []int) {- return file_store_project_proto_rawDescGZIP(), []int{4}-}--func (x *ProjectIamPolicy) GetBindings() []*Binding {- if x != nil {- return x.Bindings- }- return nil-}-var File_store_project_proto protoreflect.FileDescriptorvar file_store_project_proto_rawDesc = []byte{0x0a, 0x13, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e,0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,- 0x73, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x16, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x74, 0x79,- 0x70, 0x65, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x49, 0x0a,- 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,- 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05,- 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c,- 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0xa0, 0x02, 0x0a, 0x07, 0x50, 0x72, 0x6f,- 0x6a, 0x65, 0x63, 0x74, 0x12, 0x49, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69,- 0x6f, 0x6e, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e,- 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0f,- 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12,- 0x38, 0x0a, 0x0c, 0x69, 0x73, 0x73, 0x75, 0x65, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18,- 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,- 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x0b, 0x69, 0x73,- 0x73, 0x75, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x66, 0x6f, 0x72,- 0x63, 0x65, 0x5f, 0x69, 0x73, 0x73, 0x75, 0x65, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18,- 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x49, 0x73, 0x73, 0x75,- 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x61, 0x6c, 0x6c, 0x6f, 0x77,- 0x5f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,- 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4d, 0x6f,- 0x64, 0x69, 0x66, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2c, 0x0a,- 0x12, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x5f, 0x69, 0x73,- 0x73, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x75, 0x74, 0x6f, 0x52,- 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x49, 0x73, 0x73, 0x75, 0x65, 0x22, 0xfd, 0x02, 0x0a, 0x0e,- 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x0e,- 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3d,- 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e,- 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x54,- 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1f, 0x0a,- 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01,- 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x23,- 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18,- 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x6f,- 0x6c, 0x65, 0x73, 0x12, 0x50, 0x0a, 0x0d, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x5f, 0x73, 0x6f,- 0x75, 0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74,- 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63,- 0x68, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x0c, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x53,- 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x47, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12,- 0x21, 0x0a, 0x1d, 0x50, 0x52, 0x4f, 0x54, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x41,- 0x52, 0x47, 0x45, 0x54, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,- 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x42, 0x52, 0x41, 0x4e, 0x43, 0x48, 0x10, 0x01, 0x12, 0x0e,- 0x0a, 0x0a, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x4c, 0x49, 0x53, 0x54, 0x10, 0x02, 0x22, 0x3b,- 0x0a, 0x0c, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1d,- 0x0a, 0x19, 0x42, 0x52, 0x41, 0x4e, 0x43, 0x48, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,- 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a,- 0x08, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01, 0x22, 0x68, 0x0a, 0x07, 0x42,- 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01,- 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65,- 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x6d,- 0x62, 0x65, 0x72, 0x73, 0x12, 0x2f, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f,- 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,- 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64,- 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x47, 0x0a, 0x10, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,- 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x33, 0x0a, 0x08, 0x62, 0x69, 0x6e,- 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x42, 0x69, 0x6e,- 0x64, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x14,- 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73,- 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x49, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x14,+ 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76,+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20,+ 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72,+ 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70,+ 0x22, 0xa0, 0x02, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x49, 0x0a, 0x10,+ 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73,+ 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69,+ 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69,+ 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x0c, 0x69, 0x73, 0x73, 0x75, 0x65,+ 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e,+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4c,+ 0x61, 0x62, 0x65, 0x6c, 0x52, 0x0b, 0x69, 0x73, 0x73, 0x75, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c,+ 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x73, 0x73, 0x75, 0x65,+ 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x66,+ 0x6f, 0x72, 0x63, 0x65, 0x49, 0x73, 0x73, 0x75, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12,+ 0x34, 0x0a, 0x16, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x5f,+ 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52,+ 0x14, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x53, 0x74, 0x61, 0x74,+ 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x72, 0x65,+ 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x5f, 0x69, 0x73, 0x73, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,+ 0x08, 0x52, 0x10, 0x61, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x49, 0x73,+ 0x73, 0x75, 0x65, 0x22, 0xfd, 0x02, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69,+ 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3d, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69,+ 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74,+ 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x66, 0x69,+ 0x6c, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65,+ 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65,+ 0x64, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61,+ 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x50, 0x0a, 0x0d, 0x62,+ 0x72, 0x61, 0x6e, 0x63, 0x68, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01,+ 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74,+ 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75,+ 0x6c, 0x65, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52,+ 0x0c, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x47, 0x0a,+ 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x52, 0x4f, 0x54, 0x45,+ 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x55, 0x4e, 0x53,+ 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x42, 0x52,+ 0x41, 0x4e, 0x43, 0x48, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45,+ 0x4c, 0x49, 0x53, 0x54, 0x10, 0x02, 0x22, 0x3b, 0x0a, 0x0c, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68,+ 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x42, 0x52, 0x41, 0x4e, 0x43, 0x48,+ 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,+ 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53,+ 0x45, 0x10, 0x01, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64,+ 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,+ 0x33,}var (@@ -547,29 +414,24 @@ func file_store_project_proto_rawDescGZIP() []byte {}var file_store_project_proto_enumTypes = make([]protoimpl.EnumInfo, 2)-var file_store_project_proto_msgTypes = make([]protoimpl.MessageInfo, 5)+var file_store_project_proto_msgTypes = make([]protoimpl.MessageInfo, 3)var file_store_project_proto_goTypes = []any{(ProtectionRule_Target)(0), // 0: bytebase.store.ProtectionRule.Target(ProtectionRule_BranchSource)(0), // 1: bytebase.store.ProtectionRule.BranchSource(*Label)(nil), // 2: bytebase.store.Label(*Project)(nil), // 3: bytebase.store.Project(*ProtectionRule)(nil), // 4: bytebase.store.ProtectionRule- (*Binding)(nil), // 5: bytebase.store.Binding- (*ProjectIamPolicy)(nil), // 6: bytebase.store.ProjectIamPolicy- (*expr.Expr)(nil), // 7: google.type.Expr}var file_store_project_proto_depIdxs = []int32{4, // 0: bytebase.store.Project.protection_rules:type_name -> bytebase.store.ProtectionRule2, // 1: bytebase.store.Project.issue_labels:type_name -> bytebase.store.Label0, // 2: bytebase.store.ProtectionRule.target:type_name -> bytebase.store.ProtectionRule.Target1, // 3: bytebase.store.ProtectionRule.branch_source:type_name -> bytebase.store.ProtectionRule.BranchSource- 7, // 4: bytebase.store.Binding.condition:type_name -> google.type.Expr- 5, // 5: bytebase.store.ProjectIamPolicy.bindings:type_name -> bytebase.store.Binding- 6, // [6:6] is the sub-list for method output_type- 6, // [6:6] is the sub-list for method input_type- 6, // [6:6] is the sub-list for extension type_name- 6, // [6:6] is the sub-list for extension extendee- 0, // [0:6] is the sub-list for field type_name+ 4, // [4:4] is the sub-list for method output_type+ 4, // [4:4] is the sub-list for method input_type+ 4, // [4:4] is the sub-list for extension type_name+ 4, // [4:4] is the sub-list for extension extendee+ 0, // [0:4] is the sub-list for field type_name}func init() { file_store_project_proto_init() }@@ -614,30 +476,6 @@ func file_store_project_proto_init() {return nil}}- file_store_project_proto_msgTypes[3].Exporter = func(v any, i int) any {- switch v := v.(*Binding); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:- return &v.unknownFields- default:- return nil- }- }- file_store_project_proto_msgTypes[4].Exporter = func(v any, i int) any {- switch v := v.(*ProjectIamPolicy); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:- return &v.unknownFields- default:- return nil- }- }}type x struct{}out := protoimpl.TypeBuilder{@@ -645,7 +483,7 @@ func file_store_project_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_store_project_proto_rawDesc,NumEnums: 2,- NumMessages: 5,+ NumMessages: 3,NumExtensions: 0,NumServices: 0,},diff --git a/proto/store/policy.proto b/proto/store/policy.protoindex b9239b6570..3ec8042384 100644--- a/proto/store/policy.proto+++ b/proto/store/policy.proto@@ -87,3 +87,25 @@ message TagPolicy {// for example, the environment resource can have the sql review config tag, like "bb.tag.review_config": "reviewConfigs/{review config resource id}"map<string, string> tags = 1;}++message Binding {+ // The role that is assigned to the members.+ // Format: roles/{role}+ string role = 1;++ // Specifies the principals requesting access for a Bytebase resource.+ // For users, the member should be: users/{userUID}+ // For groups, the member should be: groups/{email}+ repeated string members = 2;++ // The condition that is associated with this binding.+ // If the condition evaluates to true, then this binding applies to the current request.+ // If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.+ google.type.Expr condition = 3;+}++message IamPolicy {+ // Collection of binding.+ // A binding binds one or more members or groups to a single role.+ repeated Binding bindings = 1;+}diff --git a/proto/store/project.proto b/proto/store/project.protoindex 6276b2007e..72ccd69593 100644--- a/proto/store/project.proto+++ b/proto/store/project.proto@@ -2,8 +2,6 @@ syntax = "proto3";package bytebase.store;-import "google/type/expr.proto";-option go_package = "generated-go/store";message Label {@@ -49,25 +47,3 @@ message ProtectionRule {}BranchSource branch_source = 5;}--message Binding {- // The role that is assigned to the members.- // Format: roles/{role}- string role = 1;-- // Specifies the principals requesting access for a Bytebase resource.- // For users, the member should be: users/{userUID}- // For groups, the member should be: groups/{email}- repeated string members = 2;-- // The condition that is associated with this binding.- // If the condition evaluates to true, then this binding applies to the current request.- // If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.- google.type.Expr condition = 3;-}--message ProjectIamPolicy {- // Collection of binding.- // A binding binds one or more members or groups to a single project role.- repeated Binding bindings = 1;-}