mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 10:25:06 +03:00
restore revoke authorization check
This commit is contained in:
2 files changed
+22
-10
No files matched your search
+10
-1
@@ -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) => (
|
||||
<Fragment key={pageIndex}>
|
||||
{page.data.map((approval) => (
|
||||
<OAuthAppsAuthorizedRow key={approval.app.id} approval={approval} />
|
||||
<OAuthAppsAuthorizedRow
|
||||
key={approval.app.id}
|
||||
approval={approval}
|
||||
canRevoke={canRevokeOAuthApps}
|
||||
/>
|
||||
))}
|
||||
</Fragment>
|
||||
))}
|
||||
|
||||
+12
-9
@@ -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<HTMLButtonElement | null>(null)
|
||||
@@ -79,14 +80,16 @@ export const OAuthAppsAuthorizedRow = ({ approval }: OAuthAppsAuthorizedRowProps
|
||||
View grants
|
||||
</DropdownMenuItem>
|
||||
</DialogTrigger>
|
||||
<DialogTrigger asChild>
|
||||
<DropdownMenuItem
|
||||
className="text-destructive"
|
||||
onClick={() => setDialogContent('revoke')}
|
||||
>
|
||||
Revoke
|
||||
</DropdownMenuItem>
|
||||
</DialogTrigger>
|
||||
{canRevoke && (
|
||||
<DialogTrigger asChild>
|
||||
<DropdownMenuItem
|
||||
className="text-destructive"
|
||||
onClick={() => setDialogContent('revoke')}
|
||||
>
|
||||
Revoke
|
||||
</DropdownMenuItem>
|
||||
</DialogTrigger>
|
||||
)}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
{dialogContent === 'grants' && <OAuthAppsMemberGrantsDialogContent approval={approval} />}
|
||||
|
||||
Reference in new issue
Block a user