Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: acl for sheet (#6622)
ecmadao35f2d481696b
diff --git a/backend/api/v1/sheet_service.go b/backend/api/v1/sheet_service.goindex d7a246a48f..ecc681b2c7 100644--- a/backend/api/v1/sheet_service.go+++ b/backend/api/v1/sheet_service.go@@ -20,6 +20,7 @@ import ("github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/common/log"+ enterpriseAPI "github.com/bytebase/bytebase/backend/enterprise/api"api "github.com/bytebase/bytebase/backend/legacyapi"vcsPlugin "github.com/bytebase/bytebase/backend/plugin/vcs""github.com/bytebase/bytebase/backend/store"@@ -30,13 +31,15 @@ import (// SheetService implements the sheet service.type SheetService struct {v1pb.UnimplementedSheetServiceServer- store *store.Store+ store *store.Store+ licenseService enterpriseAPI.LicenseService}// NewSheetService creates a new SheetService.-func NewSheetService(store *store.Store) *SheetService {+func NewSheetService(store *store.Store, licenseService enterpriseAPI.LicenseService) *SheetService {return &SheetService{- store: store,+ store: store,+ licenseService: licenseService,}}@@ -154,13 +157,17 @@ func (s *SheetService) GetSheet(ctx context.Context, request *v1pb.GetSheetRequefind.ProjectID = &project.UID}- currentPrincipalID := ctx.Value(common.PrincipalIDContextKey).(int)- sheet, err := s.store.GetSheetV2(ctx, find, currentPrincipalID)+ sheet, err := s.findSheet(ctx, find)if err != nil {- return nil, status.Errorf(codes.Internal, fmt.Sprintf("failed to get sheet: %v", err))+ return nil, err}- if sheet == nil {- return nil, status.Errorf(codes.NotFound, fmt.Sprintf("sheet with id %d not found", sheetIntID))++ canAccess, err := s.canReadSheet(ctx, sheet)+ if err != nil {+ return nil, status.Errorf(codes.Internal, fmt.Sprintf("failed to check access with error: %v", err))+ }+ if !canAccess {+ return nil, status.Errorf(codes.PermissionDenied, "cannot access sheet %s", sheet.Name)}v1pbSheet, err := s.convertToAPISheetMessage(ctx, sheet)@@ -255,6 +262,14 @@ func (s *SheetService) SearchSheets(ctx context.Context, request *v1pb.SearchShevar v1pbSheets []*v1pb.Sheetfor _, sheet := range sheetList {+ canAccess, err := s.canReadSheet(ctx, sheet)+ if err != nil {+ return nil, status.Errorf(codes.Internal, fmt.Sprintf("failed to check access with error: %v", err))+ }+ if !canAccess {+ log.Warn("cannot access sheet", zap.String("name", sheet.Name))+ continue+ }v1pbSheet, err := s.convertToAPISheetMessage(ctx, sheet)if err != nil {st := status.Convert(err)@@ -316,6 +331,13 @@ func (s *SheetService) UpdateSheet(ctx context.Context, request *v1pb.UpdateSheeif sheet == nil {return nil, status.Errorf(codes.NotFound, fmt.Sprintf("sheet with id %d not found", sheetIntID))}+ canAccess, err := s.canWriteSheet(ctx, sheet)+ if err != nil {+ return nil, status.Errorf(codes.Internal, fmt.Sprintf("failed to check access with error: %v", err))+ }+ if !canAccess {+ return nil, status.Errorf(codes.PermissionDenied, "cannot write sheet %s", sheet.Name)+ }sheetPatch := &store.PatchSheetMessage{ID: sheet.UID,@@ -329,14 +351,6 @@ func (s *SheetService) UpdateSheet(ctx context.Context, request *v1pb.UpdateSheecase "content":statement := string(request.Sheet.Content)sheetPatch.Statement = &statement- case "starred":- if _, err := s.store.UpsertSheetOrganizer(ctx, &api.SheetOrganizerUpsert{- SheetID: sheet.UID,- PrincipalID: currentPrincipalID,- Starred: request.Sheet.Starred,- }); err != nil {- return nil, status.Errorf(codes.Internal, fmt.Sprintf("failed to update sheet organizer: %v", err))- }case "visibility":visibility, err := convertToLegacyAPISheetVisibility(request.Sheet.Visibility)if err != nil {@@ -397,6 +411,13 @@ func (s *SheetService) DeleteSheet(ctx context.Context, request *v1pb.DeleteSheeif sheet == nil {return nil, status.Errorf(codes.NotFound, fmt.Sprintf("sheet with id %d not found", sheetIDInt))}+ canAccess, err := s.canWriteSheet(ctx, sheet)+ if err != nil {+ return nil, status.Errorf(codes.Internal, fmt.Sprintf("failed to check access with error: %v", err))+ }+ if !canAccess {+ return nil, status.Errorf(codes.PermissionDenied, "cannot write sheet %s", sheet.Name)+ }if err := s.store.DeleteSheet(ctx, &api.SheetDelete{ID: sheetIDInt,@@ -630,6 +651,21 @@ func (s *SheetService) UpdateSheetOrganizer(ctx context.Context, request *v1pb.Ureturn nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid sheet id %s, must be positive integer", sheetID))}+ sheet, err := s.findSheet(ctx, &api.SheetFind{+ ID: &sheetIntID,+ })+ if err != nil {+ return nil, err+ }++ canAccess, err := s.canReadSheet(ctx, sheet)+ if err != nil {+ return nil, status.Errorf(codes.Internal, fmt.Sprintf("failed to check access with error: %v", err))+ }+ if !canAccess {+ return nil, status.Errorf(codes.PermissionDenied, "cannot access sheet %s", sheet.Name)+ }+currentPrincipalID := ctx.Value(common.PrincipalIDContextKey).(int)sheetOrganizerUpsert := &api.SheetOrganizerUpsert{SheetID: sheetIntID,@@ -657,6 +693,88 @@ func (s *SheetService) UpdateSheetOrganizer(ctx context.Context, request *v1pb.U}, nil}+func (s *SheetService) findSheet(ctx context.Context, find *api.SheetFind) (*store.SheetMessage, error) {+ currentPrincipalID := ctx.Value(common.PrincipalIDContextKey).(int)+ sheet, err := s.store.GetSheetV2(ctx, find, currentPrincipalID)+ if err != nil {+ return nil, status.Errorf(codes.Internal, fmt.Sprintf("failed to get sheet: %v", err))+ }+ if sheet == nil {+ return nil, status.Errorf(codes.NotFound, "cannot find the sheet")+ }+ return sheet, nil+}++// canWriteSheet check if the principal can write the sheet.+// sheet if writable when:+// PRIVATE: the creator only.+// PROJECT: the creator or project role can manage sheet, workspace Owner and DBA.+// PUBLIC: the creator only.+func (s *SheetService) canWriteSheet(ctx context.Context, sheet *store.SheetMessage) (bool, error) {+ currentPrincipalID := ctx.Value(common.PrincipalIDContextKey).(int)++ if sheet.CreatorID == currentPrincipalID {+ return true, nil+ }++ if sheet.Visibility == api.ProjectSheet {+ projectRoles, err := s.findProjectRoles(ctx, sheet.ProjectUID, currentPrincipalID)+ if err != nil {+ return false, err+ }+ if len(projectRoles) == 0 {+ return false, nil+ }+ return projectRoles[common.ProjectOwner], nil+ }++ return false, nil+}++// canReadSheet check if the principal can read the sheet.+// sheet is readable when:+// PRIVATE: the creator only.+// PROJECT: the creator and members in the project.+// PUBLIC: everyone.+func (s *SheetService) canReadSheet(ctx context.Context, sheet *store.SheetMessage) (bool, error) {+ currentPrincipalID := ctx.Value(common.PrincipalIDContextKey).(int)+ role := ctx.Value(common.RoleContextKey).(api.Role)++ switch sheet.Visibility {+ case api.PrivateSheet:+ return sheet.CreatorID == currentPrincipalID, nil+ case api.PublicSheet:+ return true, nil+ case api.ProjectSheet:+ if role == api.Owner || role == api.DBA {+ return true, nil+ }+ projectRoles, err := s.findProjectRoles(ctx, sheet.ProjectUID, currentPrincipalID)+ if err != nil {+ return false, err+ }+ return len(projectRoles) > 0, nil+ }+ return false, nil+}++func (s *SheetService) findProjectRoles(ctx context.Context, projectUID int, principalUID int) (map[common.ProjectRole]bool, error) {+ policy, err := s.store.GetProjectPolicy(ctx, &store.GetProjectPolicyMessage{UID: &projectUID})+ if err != nil {+ return nil, err+ }+ projectRoles := make(map[common.ProjectRole]bool)+ for _, binding := range policy.Bindings {+ for _, member := range binding.Members {+ if member.ID == principalUID {+ projectRoles[common.ProjectRole(binding.Role)] = true+ break+ }+ }+ }+ return projectRoles, nil+}+func (s *SheetService) convertToAPISheetMessage(ctx context.Context, sheet *store.SheetMessage) (*v1pb.Sheet, error) {databaseParent := ""if sheet.DatabaseID != nil {diff --git a/backend/server/acl.go b/backend/server/acl.goindex 0bb079241f..8d64af30d4 100644--- a/backend/server/acl.go+++ b/backend/server/acl.go@@ -124,17 +124,8 @@ func aclMiddleware(s *Server, pathPrefix string, ce *casbin.Enforcer, next echo.return projectRoles, nil}- sheetFinder := func(sheetID int) (*api.Sheet, error) {- sheetFind := &api.SheetFind{- ID: &sheetID,- }- return s.store.GetSheet(ctx, sheetFind, principalID)- }-if strings.HasPrefix(path, "/project") {aclErr = enforceWorkspaceDeveloperProjectRouteACL(s.licenseService.GetEffectivePlan(), path, method, principalID, projectRolesFinder)- } else if strings.HasPrefix(path, "/sheet") {- aclErr = enforceWorkspaceDeveloperSheetRouteACL(s.licenseService.GetEffectivePlan(), path, method, principalID, projectRolesFinder, sheetFinder)}if aclErr != nil {return aclErr@@ -190,86 +181,6 @@ func enforceWorkspaceDeveloperProjectRouteACL(plan api.PlanType, path string, mereturn nil}-var sheetRouteRegex = regexp.MustCompile(`^/sheet/(?P<sheetID>\d+)`)-var sheetOrganizeRouteRegex = regexp.MustCompile(`^/sheet/(?P<projectID>\d+)/organize`)--func enforceWorkspaceDeveloperSheetRouteACL(plan api.PlanType, path string, method string, principalID int, projectRolesFinder func(projectID int, principalID int) (map[common.ProjectRole]bool, error), sheetFinder func(sheetID int) (*api.Sheet, error)) *echo.HTTPError {- if matches := sheetOrganizeRouteRegex.FindStringSubmatch(path); matches != nil {- sheetID, _ := strconv.Atoi(matches[1])- sheet, err := sheetFinder(sheetID)- if err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to process authorize request.").SetInternal(err)- }- if sheet == nil {- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Sheet ID not found: %d", sheetID))- }- // Creator can always manage her own sheet.- if sheet.CreatorID == principalID {- return nil- }- switch sheet.Visibility {- case api.PrivateSheet:- return echo.NewHTTPError(http.StatusForbidden, "not allowed to access private sheet created by other user")- case api.PublicSheet:- return nil- case api.ProjectSheet:- projectRoles, err := projectRolesFinder(sheet.ProjectID, principalID)- if err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to process authorize request.").SetInternal(err)- }-- if len(projectRoles) == 0 {- return echo.NewHTTPError(http.StatusForbidden, "is not a member of the project containing the sheet")- }-- if !api.ProjectPermission(api.ProjectPermissionOrganizeSheet, plan, projectRoles) {- return echo.NewHTTPError(http.StatusForbidden, "not have permission to organize the project sheet")- }- }- } else if matches := sheetRouteRegex.FindStringSubmatch(path); matches != nil {- sheetID, _ := strconv.Atoi(matches[1])- sheet, err := sheetFinder(sheetID)- if err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to process authorize request.").SetInternal(err)- }- if sheet == nil {- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Sheet ID not found: %d", sheetID))- }- // Creator can always manage her own sheet.- if sheet.CreatorID == principalID {- return nil- }- switch sheet.Visibility {- case api.PrivateSheet:- return echo.NewHTTPError(http.StatusForbidden, "not allowed to access private sheet created by other user")- case api.PublicSheet:- if method == "GET" {- return nil- }- return echo.NewHTTPError(http.StatusForbidden, "not allowed to change public sheet created by other user")- case api.ProjectSheet:- projectRoles, err := projectRolesFinder(sheet.ProjectID, principalID)- if err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to process authorize request.").SetInternal(err)- }-- if len(projectRoles) == 0 {- return echo.NewHTTPError(http.StatusForbidden, "is not a member of the project containing the sheet")- }-- if method == "GET" {- return nil- }-- if !api.ProjectPermission(api.ProjectPermissionAdminSheet, plan, projectRoles) {- return echo.NewHTTPError(http.StatusForbidden, "not have permission to change the project sheet")- }- }- }-- return nil-}-func isOperatingSelf(ctx context.Context, c echo.Context, s *Server, curPrincipalID int, method string, path string) (bool, error) {switch method {case http.MethodGet:@@ -335,26 +246,6 @@ func isUpdatingSelf(ctx context.Context, c echo.Context, s *Server, curPrincipalreturn inbox.ReceiverID == curPrincipalID, nil}- } else if strings.HasPrefix(path, "/sheet") {- if idStr := c.Param("id"); idStr != "" {- id, err := strconv.Atoi(idStr)- if err != nil {- return false, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Sheet ID is not a number: %s", idStr)).SetInternal(err)- }-- sheetFind := &api.SheetFind{- ID: &id,- }- sheet, err := s.store.GetSheet(ctx, sheetFind, curPrincipalID)- if err != nil {- return false, echo.NewHTTPError(http.StatusInternalServerError, defaultErrMsg).SetInternal(err)- }- if sheet == nil {- return false, echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Sheet ID not found: %d", id)).SetInternal(err)- }-- return sheet.CreatorID == curPrincipalID, nil- }}return false, nil}diff --git a/backend/server/acl_casbin_policy_dba.csv b/backend/server/acl_casbin_policy_dba.csvindex c5934559ef..bc9e2e4c24 100644--- a/backend/server/acl_casbin_policy_dba.csv+++ b/backend/server/acl_casbin_policy_dba.csv@@ -95,11 +95,4 @@ p, DBA, /setting, GETp, DBA, /label, GETp, DBA, /label/{labelID}, PATCHp, DBA, /feature, GET-p, DBA, /sheet, POST-p, DBA, /sheet/my, GET-p, DBA, /sheet/shared, GET-p, DBA, /sheet/starred, GET-p, DBA, /sheet/{sheetID}, GET-p, DBA, /sheet/{sheetID}, PATCH-p, DBA, /sheet/{sheetID}, DELETEp, DBA, /anomaly, GETdiff --git a/backend/server/acl_casbin_policy_developer.csv b/backend/server/acl_casbin_policy_developer.csvindex 09146a6c7e..bfcceb636a 100644--- a/backend/server/acl_casbin_policy_developer.csv+++ b/backend/server/acl_casbin_policy_developer.csv@@ -80,11 +80,4 @@ p, DEVELOPER, /vcs/{vcsID}/external-repository, GETp, DEVELOPER, /setting, GETp, DEVELOPER, /label, GETp, DEVELOPER, /feature, GET-p, DEVELOPER, /sheet, POST-p, DEVELOPER, /sheet/my, GET-p, DEVELOPER, /sheet/shared, GET-p, DEVELOPER, /sheet/starred, GET-p, DEVELOPER, /sheet/{sheetID}, GET-p, DEVELOPER, /sheet/{sheetID}, PATCH-p, DEVELOPER, /sheet/{sheetID}, DELETEp, DEVELOPER, /anomaly, GETdiff --git a/backend/server/acl_casbin_policy_owner.csv b/backend/server/acl_casbin_policy_owner.csvindex b1db06cf1b..86c1e22e36 100644--- a/backend/server/acl_casbin_policy_owner.csv+++ b/backend/server/acl_casbin_policy_owner.csv@@ -102,11 +102,4 @@ p, OWNER, /setting/{name}, PATCHp, OWNER, /label, GETp, OWNER, /label/{labelID}, PATCHp, OWNER, /feature, GET-p, OWNER, /sheet, POST-p, OWNER, /sheet/my, GET-p, OWNER, /sheet/shared, GET-p, OWNER, /sheet/starred, GET-p, OWNER, /sheet/{sheetID}, GET-p, OWNER, /sheet/{sheetID}, PATCH-p, OWNER, /sheet/{sheetID}, DELETEp, OWNER, /anomaly, GETdiff --git a/backend/server/acl_sheet_test.go b/backend/server/acl_sheet_test.godeleted file mode 100644index f77accb427..0000000000--- a/backend/server/acl_sheet_test.go+++ /dev/null@@ -1,329 +0,0 @@-package server--import (- "testing"-- api "github.com/bytebase/bytebase/backend/legacyapi"-)--func TestEnforceWorkspaceDeveloperSheetRouteACL(t *testing.T) {- type test struct {- desc string- plan api.PlanType- path string- method string- principalID int- errMsg string- }-- tests := []test{- {- desc: "Fetch own sheet",- plan: api.ENTERPRISE,- path: "/sheet/my",- method: "GET",- principalID: 1234,- errMsg: "",- },- {- desc: "Fetch shared sheet",- plan: api.ENTERPRISE,- path: "/sheet/shared",- method: "GET",- principalID: 1234,- errMsg: "",- },- {- desc: "Fetch starred sheet",- plan: api.ENTERPRISE,- path: "/sheet/starred",- method: "GET",- principalID: 1234,- errMsg: "",- },- {- desc: "Access unknown sheet",- plan: api.ENTERPRISE,- path: "/sheet/9999",- method: "GET",- principalID: 1234,- errMsg: "Sheet ID not found: 9999",- },- {- desc: "Organize unknown sheet",- plan: api.ENTERPRISE,- path: "/sheet/9999/organize",- method: "PATCH",- principalID: 1234,- errMsg: "Sheet ID not found: 9999",- },- }-- privateSheetTests := []test{- {- desc: "Access private sheet as a creator",- plan: api.ENTERPRISE,- path: "/sheet/1000",- method: "GET",- principalID: testFindPrincipalIDFromSheet(1000, "CREATOR"),- errMsg: "",- },- {- desc: "Access private sheet as a project owner",- plan: api.ENTERPRISE,- path: "/sheet/1000",- method: "GET",- principalID: testFindPrincipalIDFromSheet(1000, "OWNER"),- errMsg: "not allowed to access private sheet created by other user",- },- {- desc: "Access private sheet as a project developer",- plan: api.ENTERPRISE,- path: "/sheet/1000",- method: "GET",- principalID: testFindPrincipalIDFromSheet(1000, "DEVELOPER"),- errMsg: "not allowed to access private sheet created by other user",- },- {- desc: "Access private sheet as a non-member",- plan: api.ENTERPRISE,- path: "/sheet/1000",- method: "GET",- principalID: testFindPrincipalIDFromSheet(1000, ""),- errMsg: "not allowed to access private sheet created by other user",- },- {- desc: "Change private sheet as a creator",- plan: api.ENTERPRISE,- path: "/sheet/1000",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1000, "CREATOR"),- errMsg: "",- },- {- desc: "Change private sheet as a project owner",- plan: api.ENTERPRISE,- path: "/sheet/1000",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1000, "OWNER"),- errMsg: "not allowed to access private sheet created by other user",- },- {- desc: "Change private sheet as a project developer",- plan: api.ENTERPRISE,- path: "/sheet/1000",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1000, "DEVELOPER"),- errMsg: "not allowed to access private sheet created by other user",- },- {- desc: "Change private sheet as a non-member",- plan: api.ENTERPRISE,- path: "/sheet/1000",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1000, ""),- errMsg: "not allowed to access private sheet created by other user",- },- {- desc: "Change private sheet as a creator",- plan: api.ENTERPRISE,- path: "/sheet/1000",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1000, "CREATOR"),- errMsg: "",- },- {- desc: "Organize private sheet as a project owner",- plan: api.ENTERPRISE,- path: "/sheet/1000/organize",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1000, "OWNER"),- errMsg: "not allowed to access private sheet created by other user",- },- {- desc: "Organize private sheet as a project developer",- plan: api.ENTERPRISE,- path: "/sheet/1000/organize",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1000, "DEVELOPER"),- errMsg: "not allowed to access private sheet created by other user",- },- {- desc: "Organize private sheet as a non-member",- plan: api.ENTERPRISE,- path: "/sheet/1000/organize",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1000, ""),- errMsg: "not allowed to access private sheet created by other user",- },- }-- projectSheetTests := []test{- {- desc: "Access project sheet as a creator",- plan: api.ENTERPRISE,- path: "/sheet/1001",- method: "GET",- principalID: testFindPrincipalIDFromSheet(1001, "CREATOR"),- errMsg: "",- },- {- desc: "Access project sheet as a project owner",- plan: api.ENTERPRISE,- path: "/sheet/1001",- method: "GET",- principalID: testFindPrincipalIDFromSheet(1001, "OWNER"),- errMsg: "",- },- {- desc: "Access project sheet as a project developer",- plan: api.ENTERPRISE,- path: "/sheet/1001",- method: "GET",- principalID: testFindPrincipalIDFromSheet(1001, "DEVELOPER"),- errMsg: "",- },- {- desc: "Access project sheet as a non-member",- plan: api.ENTERPRISE,- path: "/sheet/1001",- method: "GET",- principalID: testFindPrincipalIDFromSheet(1001, ""),- errMsg: "is not a member of the project containing the sheet",- },- {- desc: "Change project sheet as a creator",- plan: api.ENTERPRISE,- path: "/sheet/1001",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1001, "CREATOR"),- errMsg: "",- },- {- desc: "Change project sheet as a project owner",- plan: api.ENTERPRISE,- path: "/sheet/1001",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1001, "OWNER"),- errMsg: "",- },- {- desc: "Change project sheet as a project developer",- plan: api.ENTERPRISE,- path: "/sheet/1001",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1001, "DEVELOPER"),- errMsg: "not have permission to change the project sheet",- },- {- desc: "Change project sheet as a non-member",- plan: api.ENTERPRISE,- path: "/sheet/1001",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1001, ""),- errMsg: "is not a member of the project containing the sheet",- },- {- desc: "Organize project sheet as a creator",- plan: api.ENTERPRISE,- path: "/sheet/1001/organize",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1001, "CREATOR"),- errMsg: "",- },- {- desc: "Organize project sheet as a project owner",- plan: api.ENTERPRISE,- path: "/sheet/1001/organize",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1001, "OWNER"),- errMsg: "",- },- {- desc: "Organize project sheet as a project developer",- plan: api.ENTERPRISE,- path: "/sheet/1001/organize",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1001, "DEVELOPER"),- errMsg: "",- },- {- desc: "Organize project sheet as a non-member",- plan: api.ENTERPRISE,- path: "/sheet/1001/organize",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1001, ""),- errMsg: "is not a member of the project containing the sheet",- },- }-- publicSheetTests := []test{- {- desc: "Access public sheet as a creator",- plan: api.ENTERPRISE,- path: "/sheet/1002",- method: "GET",- principalID: testFindPrincipalIDFromSheet(1002, "CREATOR"),- errMsg: "",- },- {- desc: "Access public sheet as a non-creator",- plan: api.ENTERPRISE,- path: "/sheet/1002",- method: "GET",- principalID: testFindPrincipalIDFromSheet(1002, ""),- errMsg: "",- },- {- desc: "Change public sheet as a creator",- plan: api.ENTERPRISE,- path: "/sheet/1002",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1002, "CREATOR"),- errMsg: "",- },- {- desc: "Change public sheet as a non-creator",- plan: api.ENTERPRISE,- path: "/sheet/1002",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1002, ""),- errMsg: "not allowed to change public sheet created by other user",- },- {- desc: "Organize public sheet as a creator",- plan: api.ENTERPRISE,- path: "/sheet/1002/organize",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1002, "CREATOR"),- errMsg: "",- },- {- desc: "Organize public sheet as a non-creator",- plan: api.ENTERPRISE,- path: "/sheet/1002/organize",- method: "PATCH",- principalID: testFindPrincipalIDFromSheet(1002, ""),- errMsg: "",- },- }-- tests = append(tests, privateSheetTests...)- tests = append(tests, projectSheetTests...)- tests = append(tests, publicSheetTests...)-- for _, tc := range tests {- t.Run(tc.desc, func(t *testing.T) {- err := enforceWorkspaceDeveloperSheetRouteACL(tc.plan, tc.path, tc.method, tc.principalID, projectRolesFinderForTest, sheetFinderForTest)- if err != nil {- if tc.errMsg == "" {- t.Errorf("expect no error, got %s", err.Message)- } else if tc.errMsg != err.Message {- t.Errorf("expect error %s, got %s", tc.errMsg, err.Message)- }- } else if tc.errMsg != "" {- t.Errorf("expect error %s, got no error", tc.errMsg)- }- })- }-}diff --git a/backend/server/acl_test_helper.go b/backend/server/acl_test_helper.goindex d0bdb0406e..beb64f5585 100644--- a/backend/server/acl_test_helper.go+++ b/backend/server/acl_test_helper.go@@ -4,7 +4,6 @@ import ("github.com/pkg/errors""github.com/bytebase/bytebase/backend/common"- api "github.com/bytebase/bytebase/backend/legacyapi")// map from project ID to the map of <role, principal ID List>.@@ -18,33 +17,6 @@ var testProjectMemberMap = map[int]map[common.ProjectRole][]int{},}-// map from sheet ID to the project ID.-var testSheetProjectMap = map[int]int{- 1000: 100,- 1001: 100,- 1002: 100,-}--// map from sheet ID to the map of <string, principal ID>-// string can be one of the project roles or "CREATOR" which represents the sheet creator.-var testSheetMemberMap = map[int]map[string]int{- 1000: {- "OWNER": 200,- "DEVELOPER": 201,- "CREATOR": 202,- },- 1001: {- "OWNER": 200,- "DEVELOPER": 201,- "CREATOR": 202,- },- 1002: {- "OWNER": 200,- "DEVELOPER": 201,- "CREATOR": 202,- },-}-// Get any principal with a certain role from the project.func testFindPrincipalIDFromProject(projectID int, role common.ProjectRole) int {m, ok := testProjectMemberMap[projectID]@@ -62,19 +34,6 @@ func testFindPrincipalIDFromProject(projectID int, role common.ProjectRole) intreturn ids[0]}-func testFindPrincipalIDFromSheet(sheetID int, v string) int {- m, ok := testSheetMemberMap[sheetID]- if !ok {- return 999- }-- id, ok := m[v]- if !ok {- return 999- }- return id-}-var projectRolesFinderForTest = func(projectID int, principalID int) (map[common.ProjectRole]bool, error) {m, ok := testProjectMemberMap[projectID]if !ok {@@ -91,30 +50,3 @@ var projectRolesFinderForTest = func(projectID int, principalID int) (map[common}return projectRoles, nil}--var sheetFinderForTest = func(sheetID int) (*api.Sheet, error) {- switch sheetID {- case 1000:- return &api.Sheet{- ID: 1000,- CreatorID: testFindPrincipalIDFromSheet(1000, "CREATOR"),- ProjectID: testSheetProjectMap[1000],- Visibility: api.PrivateSheet,- }, nil- case 1001:- return &api.Sheet{- ID: 1001,- CreatorID: testFindPrincipalIDFromSheet(1001, "CREATOR"),- ProjectID: testSheetProjectMap[1001],- Visibility: api.ProjectSheet,- }, nil- case 1002:- return &api.Sheet{- ID: 1002,- CreatorID: testFindPrincipalIDFromSheet(1002, "CREATOR"),- ProjectID: testSheetProjectMap[1002],- Visibility: api.PublicSheet,- }, nil- }- return nil, nil-}diff --git a/backend/server/server.go b/backend/server/server.goindex 84e855b16c..c9e16d8f1a 100644--- a/backend/server/server.go+++ b/backend/server/server.go@@ -598,7 +598,7 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {v1pb.RegisterReviewServiceServer(s.grpcServer, v1.NewReviewService(s.store, s.ActivityManager, s.TaskScheduler, s.stateCfg))v1pb.RegisterRolloutServiceServer(s.grpcServer, v1.NewRolloutService(s.store, s.licenseService, s.dbFactory, s.TaskScheduler, s.TaskCheckScheduler, s.stateCfg, s.ActivityManager))v1pb.RegisterRoleServiceServer(s.grpcServer, v1.NewRoleService(s.store, s.licenseService))- v1pb.RegisterSheetServiceServer(s.grpcServer, v1.NewSheetService(s.store))+ v1pb.RegisterSheetServiceServer(s.grpcServer, v1.NewSheetService(s.store, s.licenseService))v1pb.RegisterCelServiceServer(s.grpcServer, v1.NewCelService())v1pb.RegisterLoggingServiceServer(s.grpcServer, v1.NewLoggingService(s.store))v1pb.RegisterBookmarkServiceServer(s.grpcServer, v1.NewBookmarkService(s.store))diff --git a/backend/store/sheet.go b/backend/store/sheet.goindex 98bd5e62ac..c587f45282 100644--- a/backend/store/sheet.go+++ b/backend/store/sheet.go@@ -7,7 +7,6 @@ import ("strings""time"- "github.com/lib/pq""github.com/pkg/errors""github.com/bytebase/bytebase/backend/common"@@ -656,6 +655,7 @@ func (s *Store) composeSheetMessage(ctx context.Context, sheetMessage *SheetMess}// GetSheetV2 gets a sheet.+// TODO: use store.FindSheetMessage instead of the api.SheetFind.func (s *Store) GetSheetV2(ctx context.Context, find *api.SheetFind, currentPrincipalID int) (*SheetMessage, error) {sheets, err := s.ListSheetsV2(ctx, find, currentPrincipalID)if err != nil {@@ -672,39 +672,6 @@ func (s *Store) GetSheetV2(ctx context.Context, find *api.SheetFind, currentPrinreturn sheet, nil}-// GetSheetUsedByIssues returns a list of issues that have tasks that are using the sheet.-func (s *Store) GetSheetUsedByIssues(ctx context.Context, sheetID int) ([]int, error) {- query := `- SELECT ARRAY_AGG(issue.id)- FROM issue- JOIN task ON task.pipeline_id = issue.pipeline_id- WHERE task.payload ? 'sheetId' AND (task.payload->>'sheetId')::INT = $1- `-- tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})- if err != nil {- return nil, err- }- defer tx.Rollback()-- var issueIDs []sql.NullInt32- if err := tx.QueryRowContext(ctx, query, sheetID).Scan(pq.Array(&issueIDs)); err != nil {- return nil, err- }- if err := tx.Commit(); err != nil {- return nil, err- }-- var ids []int- for _, id := range issueIDs {- if id.Valid {- ids = append(ids, int(id.Int32))- }- }-- return ids, nil-}-// ListSheetsV2 returns a list of sheets.func (s *Store) ListSheetsV2(ctx context.Context, find *api.SheetFind, currentPrincipalID int) ([]*SheetMessage, error) {where, args := []string{"TRUE"}, []any{}diff --git a/frontend/src/store/modules/v1/sheet.ts b/frontend/src/store/modules/v1/sheet.tsindex 7b22cd53b4..8559cb941c 100644--- a/frontend/src/store/modules/v1/sheet.ts+++ b/frontend/src/store/modules/v1/sheet.ts@@ -262,12 +262,6 @@ const getUpdateMaskForSheet = () {updateMask.push("visibility");}- if (- !isUndefined(update.starred) &&- !isEqual(origin.starred, update.starred)- ) {- updateMask.push("starred");- }if (!isUndefined(update.payload) &&!isEqual(origin.payload, update.payload)diff --git a/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue b/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vueindex b2abc4f9be..24566d118e 100644--- a/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue+++ b/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue@@ -55,22 +55,14 @@ const options = computed(() => {});}- const canDeleteSheet = isSheetWritableV1(sheet);- if (view === "my") {- if (canDeleteSheet) {- options.push({- key: "delete",- label: t("common.delete"),- });- }- } else if (view === "shared") {- if (canDeleteSheet) {- options.push({- key: "delete",- label: t("common.delete"),- });- }-+ const canWriteSheet = isSheetWritableV1(sheet);+ if (canWriteSheet) {+ options.push({+ key: "delete",+ label: t("common.delete"),+ });+ }+ if (view === "shared") {options.push({key: "duplicate",label: t("common.duplicate"),diff --git a/proto/generated-go/v1/sheet_service.pb.go b/proto/generated-go/v1/sheet_service.pb.goindex b3c5fc18aa..f9f7e95cd3 100644--- a/proto/generated-go/v1/sheet_service.pb.go+++ b/proto/generated-go/v1/sheet_service.pb.go@@ -979,7 +979,7 @@ var file_v1_sheet_service_proto_rawDesc = []byte{0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e,0x22, 0x2b, 0x0a, 0x11, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65,0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18,- 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x22, 0xd5, 0x06,+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x22, 0xda, 0x06,0x0a, 0x05, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xe0, 0x41, 0x02, 0xe0, 0x41, 0x05, 0x52, 0x04, 0x6e,0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18,@@ -1011,91 +1011,91 @@ var file_v1_sheet_service_proto_rawDesc = []byte{0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17,0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65,0x65, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x74, 0x79,- 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x72, 0x72, 0x65, 0x64, 0x18, 0x0c, 0x20,- 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x72, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07,- 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70,- 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x6f, 0x0a, 0x0a, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69,- 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x16, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49,- 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00,- 0x12, 0x15, 0x0a, 0x11, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50,- 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x56, 0x49, 0x53, 0x49, 0x42,- 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12,- 0x16, 0x0a, 0x12, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x52,- 0x49, 0x56, 0x41, 0x54, 0x45, 0x10, 0x03, 0x22, 0x8f, 0x01, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72,- 0x63, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x53,- 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x4f,- 0x55, 0x52, 0x43, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01, 0x12,- 0x1c, 0x0a, 0x18, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x42, 0x41,- 0x53, 0x45, 0x5f, 0x41, 0x52, 0x54, 0x49, 0x46, 0x41, 0x43, 0x54, 0x10, 0x02, 0x12, 0x11, 0x0a,- 0x0d, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x4c, 0x41, 0x42, 0x10, 0x03,- 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55,- 0x42, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x42, 0x49,- 0x54, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x05, 0x22, 0x2a, 0x0a, 0x04, 0x54, 0x79, 0x70,- 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43,- 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x59, 0x50, 0x45, 0x5f,- 0x53, 0x51, 0x4c, 0x10, 0x01, 0x32, 0xc4, 0x07, 0x0a, 0x0c, 0x53, 0x68, 0x65, 0x65, 0x74, 0x53,- 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74,- 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74,- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x22, 0x3c, 0xda, 0x41, 0x0c,- 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x2c, 0x73, 0x68, 0x65, 0x65, 0x74, 0x82, 0xd3, 0xe4, 0x93,- 0x02, 0x27, 0x3a, 0x05, 0x73, 0x68, 0x65, 0x65, 0x74, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b,- 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f,- 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x12, 0x6b, 0x0a, 0x08, 0x47, 0x65, 0x74,- 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,- 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75,- 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,- 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x22, 0x2d, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65,- 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x12, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d,- 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65,- 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x82, 0x01, 0x0a, 0x0c, 0x53, 0x65, 0x61, 0x72, 0x63,- 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x68, 0x65, 0x65,- 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65,- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x68,- 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3,- 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e,- 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68,- 0x65, 0x65, 0x74, 0x73, 0x3a, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x8b, 0x01, 0x0a, 0x0b,- 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,+ 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x72, 0x72, 0x65, 0x64, 0x18, 0x0c, 0x20,+ 0x01, 0x28, 0x08, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x72, 0x65,+ 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x0d, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x6f, 0x0a, 0x0a, 0x56,+ 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x16, 0x56, 0x49, 0x53,+ 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,+ 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c,+ 0x49, 0x54, 0x59, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12,+ 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45,+ 0x43, 0x54, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49,+ 0x54, 0x59, 0x5f, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10, 0x03, 0x22, 0x8f, 0x01, 0x0a,+ 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43,+ 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12,+ 0x13, 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x42, 0x41,+ 0x53, 0x45, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x42,+ 0x59, 0x54, 0x45, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x41, 0x52, 0x54, 0x49, 0x46, 0x41, 0x43, 0x54,+ 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x47, 0x49, 0x54,+ 0x4c, 0x41, 0x42, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,+ 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x4f, 0x55, 0x52,+ 0x43, 0x45, 0x5f, 0x42, 0x49, 0x54, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x05, 0x22, 0x2a,+ 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55,+ 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08,+ 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x51, 0x4c, 0x10, 0x01, 0x32, 0xc4, 0x07, 0x0a, 0x0c, 0x53,+ 0x68, 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x0b,+ 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,0x53, 0x68, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x62,0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74,- 0x22, 0x47, 0xda, 0x41, 0x11, 0x73, 0x68, 0x65, 0x65, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74,- 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x3a, 0x05, 0x73, 0x68,- 0x65, 0x65, 0x74, 0x32, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x65, 0x74, 0x2e,- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f,- 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xbd, 0x01, 0x0a, 0x14, 0x55, 0x70,- 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a,- 0x65, 0x72, 0x12, 0x28, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,- 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61,- 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62,- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74,- 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x22, 0x5e, 0xda, 0x41, 0x15, 0x6f, 0x72,- 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d,- 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x40, 0x3a, 0x09, 0x6f, 0x72, 0x67, 0x61, 0x6e,- 0x69, 0x7a, 0x65, 0x72, 0x1a, 0x33, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6f, 0x72, 0x67, 0x61, 0x6e,- 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x68, 0x65, 0x65, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65,- 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f,- 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x75, 0x0a, 0x0b, 0x44, 0x65, 0x6c,- 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65,- 0x65, 0x74, 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, 0x2d, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20,- 0x2a, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a,- 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d,- 0x12, 0x7a, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x12, 0x1e,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x6e,- 0x63, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,+ 0x22, 0x3c, 0xda, 0x41, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x2c, 0x73, 0x68, 0x65, 0x65,+ 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x05, 0x73, 0x68, 0x65, 0x65, 0x74, 0x22, 0x1e,+ 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a,+ 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x12, 0x6b,+ 0x0a, 0x08, 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x65,+ 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x22, 0x2d, 0xda, 0x41,+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x12, 0x1e, 0x2f, 0x76, 0x31,+ 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f,+ 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x82, 0x01, 0x0a, 0x0c,+ 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x12, 0x20, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63,+ 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21,+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61,+ 0x72, 0x63, 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,+ 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x7b,+ 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f,+ 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x3a, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68,+ 0x12, 0x8b, 0x01, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74,+ 0x12, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55,+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,+ 0x74, 0x1a, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,+ 0x53, 0x68, 0x65, 0x65, 0x74, 0x22, 0x47, 0xda, 0x41, 0x11, 0x73, 0x68, 0x65, 0x65, 0x74, 0x2c,+ 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02,+ 0x2d, 0x3a, 0x05, 0x73, 0x68, 0x65, 0x65, 0x74, 0x32, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x73,+ 0x68, 0x65, 0x65, 0x74, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,+ 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xbd,+ 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x4f, 0x72,+ 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x28, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65,+ 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,+ 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,+ 0x53, 0x68, 0x65, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x22, 0x5e,+ 0xda, 0x41, 0x15, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64,+ 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x40, 0x3a, 0x09,+ 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x1a, 0x33, 0x2f, 0x76, 0x31, 0x2f, 0x7b,+ 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x68, 0x65, 0x65, 0x74, 0x3d,+ 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74,+ 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x75,+ 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1f, 0x2e,+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65,+ 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 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, 0x34, 0xda, 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e,- 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x22, 0x23, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61,- 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d,- 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x3a, 0x73, 0x79, 0x6e, 0x63, 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, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2d, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82,+ 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x2a, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,+ 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65,+ 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x7a, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x68, 0x65,+ 0x65, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,+ 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 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, 0x34, 0xda, 0x41, 0x06,+ 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x22, 0x23, 0x2f, 0x76,+ 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,+ 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x3a, 0x73, 0x79, 0x6e,+ 0x63, 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/v1/sheet_service.proto b/proto/v1/sheet_service.protoindex 022af2258b..4929bb7b5e 100644--- a/proto/v1/sheet_service.proto+++ b/proto/v1/sheet_service.proto@@ -237,7 +237,7 @@ message Sheet {Type type = 11 [(google.api.field_behavior) = REQUIRED];// starred indicates whether the sheet is starred by the current authenticated user.- bool starred = 12;+ bool starred = 12 [(google.api.field_behavior) = OUTPUT_ONLY];// TODO: deprecate this field.string payload = 13;