mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(backend): Remove Google Sheets API scopes from block inputs (#11484)
Eliminates explicit Google Sheets API scopes from credentials fields in all Google Sheets-related blocks. This change may be intended to centralize or dynamically manage API scopes elsewhere, simplifying block configuration. <!-- Clearly explain the need for these changes: --> ### Changes 🏗️ - removes the scopes we aren't approved to use <!-- Concisely describe all of the changes made in this pull request: --> ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] Bently tested it on his fresh account and it worked!
This commit is contained in:
@@ -112,12 +112,6 @@ def GoogleDrivePickerField(
|
||||
# Use drive.file for minimal scope - only access files selected by user in picker
|
||||
picker_scopes.add("https://www.googleapis.com/auth/drive.file")
|
||||
|
||||
views = set(allowed_views or [])
|
||||
if "SPREADSHEETS" in views:
|
||||
picker_scopes.add("https://www.googleapis.com/auth/spreadsheets.readonly")
|
||||
if "DOCUMENTS" in views or "DOCS" in views:
|
||||
picker_scopes.add("https://www.googleapis.com/auth/documents.readonly")
|
||||
|
||||
picker_config["scopes"] = sorted(picker_scopes)
|
||||
|
||||
# Set appropriate default value
|
||||
|
||||
@@ -250,9 +250,7 @@ class BatchOperation(BlockSchemaInput):
|
||||
|
||||
class GoogleSheetsReadBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets.readonly"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
@@ -375,9 +373,7 @@ class GoogleSheetsReadBlock(Block):
|
||||
|
||||
class GoogleSheetsWriteBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
@@ -513,9 +509,7 @@ class GoogleSheetsWriteBlock(Block):
|
||||
|
||||
class GoogleSheetsAppendBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
@@ -696,9 +690,7 @@ class GoogleSheetsAppendBlock(Block):
|
||||
|
||||
class GoogleSheetsClearBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
@@ -806,9 +798,7 @@ class GoogleSheetsClearBlock(Block):
|
||||
|
||||
class GoogleSheetsMetadataBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets.readonly"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
@@ -928,9 +918,7 @@ class GoogleSheetsMetadataBlock(Block):
|
||||
|
||||
class GoogleSheetsManageSheetBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
@@ -1085,9 +1073,7 @@ class GoogleSheetsManageSheetBlock(Block):
|
||||
|
||||
class GoogleSheetsBatchOperationsBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
@@ -1242,9 +1228,7 @@ class GoogleSheetsBatchOperationsBlock(Block):
|
||||
|
||||
class GoogleSheetsFindReplaceBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
@@ -1392,9 +1376,7 @@ class GoogleSheetsFindReplaceBlock(Block):
|
||||
|
||||
class GoogleSheetsFindBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets.readonly"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
@@ -1700,9 +1682,7 @@ class GoogleSheetsFindBlock(Block):
|
||||
|
||||
class GoogleSheetsFormatBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
@@ -1875,9 +1855,7 @@ class GoogleSheetsFormatBlock(Block):
|
||||
|
||||
class GoogleSheetsCreateSpreadsheetBlock(Block):
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
title: str = SchemaField(
|
||||
description="The title of the new spreadsheet",
|
||||
)
|
||||
@@ -2017,9 +1995,7 @@ class GoogleSheetsUpdateCellBlock(Block):
|
||||
"""Update a single cell in a Google Sheets spreadsheet."""
|
||||
|
||||
class Input(BlockSchemaInput):
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField(
|
||||
["https://www.googleapis.com/auth/spreadsheets"]
|
||||
)
|
||||
credentials: GoogleCredentialsInput = GoogleCredentialsField([])
|
||||
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
|
||||
title="Spreadsheet",
|
||||
description="Select a Google Sheets spreadsheet",
|
||||
|
||||
Reference in New Issue
Block a user