restore revoke authorization check

This commit is contained in:
Gildas Garcia committed 2026-10-01 12:29:16 +02:00
1 parent 263457a243
commit ce6830ec37
2 files changed
+22 -10

No files matched your search

@@ -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>
))}
@@ -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} />}