Skip to content

Conversation

@dkindlund
Copy link
Contributor

@dkindlund dkindlund commented Oct 22, 2025

Summary

Adds three trash-related OAuth scopes to enable programmatic trash management via API.

Problem

OAuth applications currently cannot access trash management endpoints because the required scopes are rejected during validation with the error:

Invalid enum value. Expected 'table|create' | 'table|delete' | ... | 'user|email_read',
received 'table|trash_read'

While trash management API endpoints are fully functional (documented in #1936), the OAuth scope validation in
packages/core/src/auth/oauth.ts does not include the necessary trash-related permissions.

Solution

This PR adds three trash-related scopes to the OAUTH_ACTIONS array:

  • table|trash_read - List deleted items from trash
  • table|trash_update - Permanently delete items from trash
  • table|trash_reset - Bulk empty trash for bases/tables

These scopes are already properly defined in packages/core/src/auth/actions.ts (lines 54-56) but were not exposed to OAuth applications.

Changes

Modified File: packages/core/src/auth/oauth.ts

Added three lines to the OAUTH_ACTIONS array after the existing table actions:

'table|trash_read',
'table|trash_update',
'table|trash_reset',

Impact

  • ✅ OAuth applications can now be configured with trash management permissions
  • ✅ No breaking changes - only adds new optional scopes
  • ✅ Enables automation of trash cleanup workflows
  • ✅ Maintains consistency with existing trash API endpoints

Testing

⚠️ No testing was performed prior to this PR submitted. ⚠️

Once merged in Teable EE, I'll be able to perform the following tests:

  1. Create/edit an OAuth application in Teable admin interface
  2. Add trash-related scopes (table|trash_read, table|trash_update, table|trash_reset)
  3. Verify no validation errors occur
  4. Confirm OAuth app can access trash endpoints:
    - GET /trash?resourceType=space
    - GET /trash?resourceType=base
    - DELETE /space/{id}/permanent
    - DELETE /base/{id}/permanent
    - DELETE /trash/reset-items?resourceType=base&resourceId={id}
    - DELETE /trash/reset-items?resourceType=table&resourceId={id}

Related

Checklist

  • Code follows project style guidelines
  • Changes are backward compatible
  • No breaking changes introduced
  • Commit message follows conventional commits format

dkindlund and others added 2 commits October 21, 2025 22:16
- Add 'table|trash_read' for listing deleted items
- Add 'table|trash_update' for permanent deletion operations
- Add 'table|trash_reset' for bulk trash emptying operations

These scopes are already defined in actions.ts but were not exposed
to OAuth applications. This enables programmatic trash management
via the trash API endpoints documented in discussion teableio#1936.
@dkindlund dkindlund changed the title feat: add trash management scopes to OAuth actions fix: add trash management scopes to OAuth actions Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant