fix: add trash management scopes to OAuth actions #2020
+3
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.tsdoes not include the necessary trash-related permissions.Solution
This PR adds three trash-related scopes to the
OAUTH_ACTIONSarray:table|trash_read- List deleted items from trashtable|trash_update- Permanently delete items from trashtable|trash_reset- Bulk empty trash for bases/tablesThese 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.tsAdded three lines to the
OAUTH_ACTIONSarray after the existing table actions:Impact
Testing
Once merged in Teable EE, I'll be able to perform the following tests:
- 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