Skip to content

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

chore: init workspace approval setting (#5193)

p0ny4335e744cff6
diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.go
index 333d757aec..8edce2d1a0 100644
--- a/backend/api/v1/setting_service.go
+++ b/backend/api/v1/setting_service.go
@@ -36,6 +36,7 @@ var whitelistSettings = []api.SettingName{
api.SettingAppIM,
api.SettingWatermark,
api.SettingPluginOpenAIKey,
+ api.SettingWorkspaceApproval,
}
// GetSetting gets the setting by name.
diff --git a/backend/server/server.go b/backend/server/server.go
index eafefc0aaf..6e50a805bc 100644
--- a/backend/server/server.go
+++ b/backend/server/server.go
@@ -707,6 +707,20 @@ func (s *Server) getInitSetting(ctx context.Context, datastore *store.Store) (*w
return nil, err
}
+ // initial workspace approval setting
+ approvalSettingValue, err := protojson.Marshal(&storepb.WorkspaceApprovalSetting{})
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to marshal initial workspace approval setting")
+ }
+ if _, _, err := datastore.CreateSettingIfNotExistV2(ctx, &store.SettingMessage{
+ Name: api.SettingWorkspaceApproval,
+ // Value is ""
+ Value: string(approvalSettingValue),
+ Description: "The workspace approval setting",
+ }, api.SystemBotID); err != nil {
+ return nil, err
+ }
+
// initial workspace profile setting
settingName := api.SettingWorkspaceProfile
workspaceProfileSetting, err := s.store.GetSettingV2(ctx, &store.FindSettingMessage{