From ce6830ec374b31ae4b0465052bd3a697a189fee2 Mon Sep 17 00:00:00 2001 From: Gildas Garcia <1122076+djhi@users.noreply.github.com> Date: Mon, 28 Sep 2026 17:25:27 +0200 Subject: [PATCH] restore revoke authorization check --- .../OAuthApps/OAuthAppsAuthorizedList.tsx | 11 +++++++++- .../OAuthApps/OAuthAppsAuthorizedRow.tsx | 21 +++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppsAuthorizedList.tsx b/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppsAuthorizedList.tsx index e6c6670214a..e006b397932 100644 --- a/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppsAuthorizedList.tsx +++ b/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppsAuthorizedList.tsx @@ -27,6 +27,11 @@ export const OAuthAppsAuthorizedList = () => { 'approved_oauth_apps' ) + const { can: canRevokeOAuthApps } = useAsyncCheckPermissions( + PermissionAction.DELETE, + 'approved_oauth_apps' + ) + const { data, isPending, @@ -101,7 +106,11 @@ export const OAuthAppsAuthorizedList = () => { {data.pages.map((page, pageIndex) => ( {page.data.map((approval) => ( - + ))} ))} diff --git a/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppsAuthorizedRow.tsx b/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppsAuthorizedRow.tsx index b168a666111..2c26e8289c1 100644 --- a/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppsAuthorizedRow.tsx +++ b/apps/studio/components/interfaces/Organization/OAuthApps/OAuthAppsAuthorizedRow.tsx @@ -21,9 +21,10 @@ import type { OAuthApprovalItem, OAuthApprovalTarget } from '@/data/oauth-apps/t export interface OAuthAppsAuthorizedRowProps { approval: OAuthApprovalItem + canRevoke: boolean } -export const OAuthAppsAuthorizedRow = ({ approval }: OAuthAppsAuthorizedRowProps) => { +export const OAuthAppsAuthorizedRow = ({ approval, canRevoke }: OAuthAppsAuthorizedRowProps) => { const [isDialogOpen, setIsDialogOpen] = useState(false) const [dialogContent, setDialogContent] = useState<'grants' | 'revoke' | null>(null) const menuTriggerRef = useRef(null) @@ -79,14 +80,16 @@ export const OAuthAppsAuthorizedRow = ({ approval }: OAuthAppsAuthorizedRowProps View grants - - setDialogContent('revoke')} - > - Revoke - - + {canRevoke && ( + + setDialogContent('revoke')} + > + Revoke + + + )} {dialogContent === 'grants' && }