mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 05:09:12 +03:00
feat: drop the upfront over-role warning from the consent screen
Role validation is post-submit only, so the screen no longer pre-computes over-role scope groups or warns about them before authorizing. The test now guards that neither the banner nor the per-scope annotation renders for the read-only fixture. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
746a53e2bd
commit
bbee0eb288
2 files changed
+6
-33
No files matched your search
+4
-10
@@ -19,20 +19,14 @@ describe('OAuthAppsAuthorizeScreen', () => {
|
||||
expect(screen.getByText('Must select at least one project to authorize.')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
test('shows the over-role warning only for the read-only fixture', async () => {
|
||||
const { unmount } = customRender(
|
||||
<OAuthAppsAuthorizeScreen mockState="ideal" navigate={vi.fn()} />
|
||||
)
|
||||
test('shows no upfront over-role warning, even for the read-only fixture', async () => {
|
||||
customRender(<OAuthAppsAuthorizeScreen mockState="over_role" navigate={vi.fn()} />)
|
||||
|
||||
await screen.findByText('Permissions requested')
|
||||
expect(
|
||||
screen.queryByText('Some requested permissions exceed your role')
|
||||
).not.toBeInTheDocument()
|
||||
unmount()
|
||||
|
||||
customRender(<OAuthAppsAuthorizeScreen mockState="over_role" navigate={vi.fn()} />)
|
||||
expect(
|
||||
await screen.findByText('Some requested permissions exceed your role')
|
||||
).toBeInTheDocument()
|
||||
expect(screen.queryByText('Read-only for your role')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
test('renders the empty-org notice, hides permissions, and shows the cancel footer', async () => {
|
||||
|
||||
+2
-23
@@ -1,12 +1,11 @@
|
||||
import { BadgeCheck } from 'lucide-react'
|
||||
import { useMemo, useState } from 'react'
|
||||
import { useState } from 'react'
|
||||
import { Button } from 'ui'
|
||||
import { Admonition } from 'ui-patterns/Admonition'
|
||||
|
||||
import { AuthorizingAsCard } from './AuthorizingAsCard'
|
||||
import { NoProjectsNotice } from './NoProjectsNotice'
|
||||
import { EMPTY_ORG_MOCK_SLUG, getMockScenarioId } from './OAuthAppsAuthorizeScreen.utils'
|
||||
import { isScopeGroupOverRole } from './OverRoleAnnotation.utils'
|
||||
import { ProjectMultiSelect } from './ProjectMultiSelect'
|
||||
import { ScopeGroupCard } from './ScopeGroupCard'
|
||||
import {
|
||||
@@ -70,14 +69,6 @@ export const OAuthAppsAuthorizeScreen = ({
|
||||
const isSubmitting = approveMutation.isPending
|
||||
const hasProjects = (projects?.length ?? 0) > 0
|
||||
|
||||
const overRoleGroups = useMemo(
|
||||
() =>
|
||||
(request?.scope_groups ?? []).filter((group) =>
|
||||
isScopeGroupOverRole(group.level, memberOrg?.role ?? '')
|
||||
),
|
||||
[request?.scope_groups, memberOrg?.role]
|
||||
)
|
||||
|
||||
if (!request || !identity || !orgSlug || !memberOrg) return null
|
||||
|
||||
const handleSignOut = async () => {
|
||||
@@ -172,19 +163,7 @@ export const OAuthAppsAuthorizeScreen = ({
|
||||
|
||||
{hasProjects && (
|
||||
<>
|
||||
<ScopeGroupCard
|
||||
appName={request.app_name}
|
||||
scopeGroups={request.scope_groups}
|
||||
memberRole={memberOrg.role}
|
||||
/>
|
||||
|
||||
{overRoleGroups.length > 0 && (
|
||||
<Admonition
|
||||
type="default"
|
||||
title="Some requested permissions exceed your role"
|
||||
description={`You can still authorize, ${request.app_name} will work within what your role allows.`}
|
||||
/>
|
||||
)}
|
||||
<ScopeGroupCard appName={request.app_name} scopeGroups={request.scope_groups} />
|
||||
|
||||
<Admonition
|
||||
type="default"
|
||||
|
||||
Reference in new issue
Block a user