mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
fix: Fix a type error in List JIT access API (#49612)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved database access rule handling by excluding records without an associated user. * Preserved valid user-rule mappings while preventing incomplete entries from being included. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
1 parent
0b5be1fada
commit
df002b4018
2 files changed
+57
-29
No files matched your search
+13
-9
@@ -257,7 +257,9 @@ export function mapJitMembersToUserRules(
|
||||
const memberMap = new Map((projectMembers ?? []).map((member) => [member.user_id, member]))
|
||||
const baseRoleIds = roleOptions.map((role) => role.id)
|
||||
|
||||
return (jitMembers ?? []).map((item) => {
|
||||
return (jitMembers ?? []).flatMap((item) => {
|
||||
if (!item.user_id) return []
|
||||
|
||||
const mappedMember = memberMap.get(item.user_id)
|
||||
const assignedRoles: JitRoleGrantDraft[] = (item.user_roles ?? []).map((roleObj) => {
|
||||
const roleWithBranchRestriction = roleObj as typeof roleObj & { branches_only?: boolean }
|
||||
@@ -294,14 +296,16 @@ export function mapJitMembersToUserRules(
|
||||
const email = mappedMember?.primary_email ?? item.user_id
|
||||
const name = mappedMember?.username ?? undefined
|
||||
|
||||
return {
|
||||
id: item.user_id,
|
||||
memberId: item.user_id,
|
||||
email,
|
||||
name,
|
||||
grants: cloneGrants(grants),
|
||||
status: computeStatusFromGrants(grants),
|
||||
}
|
||||
return [
|
||||
{
|
||||
id: item.user_id,
|
||||
memberId: item.user_id,
|
||||
email,
|
||||
name,
|
||||
grants: cloneGrants(grants),
|
||||
status: computeStatusFromGrants(grants),
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Vendored
+44
-20
@@ -3348,28 +3348,52 @@ export interface components {
|
||||
}
|
||||
}
|
||||
JitListAccessResponse: {
|
||||
items: {
|
||||
expires_at: null
|
||||
invite_id: null
|
||||
primary_email: string | null
|
||||
/** Format: uuid */
|
||||
user_id: string
|
||||
user_roles: {
|
||||
allowed_networks?: {
|
||||
allowed_cidrs?: {
|
||||
/** Format: cidrv4 */
|
||||
cidr: string
|
||||
}[]
|
||||
allowed_cidrs_v6?: {
|
||||
/** Format: cidrv6 */
|
||||
cidr: string
|
||||
items: (
|
||||
| {
|
||||
expires_at: null
|
||||
invite_id: null
|
||||
primary_email: string | null
|
||||
/** Format: uuid */
|
||||
user_id: string
|
||||
user_roles: {
|
||||
allowed_networks?: {
|
||||
allowed_cidrs?: {
|
||||
/** Format: cidrv4 */
|
||||
cidr: string
|
||||
}[]
|
||||
allowed_cidrs_v6?: {
|
||||
/** Format: cidrv6 */
|
||||
cidr: string
|
||||
}[]
|
||||
}
|
||||
branches_only?: boolean
|
||||
expires_at?: number
|
||||
role: string
|
||||
}[]
|
||||
}
|
||||
branches_only?: boolean
|
||||
expires_at?: number
|
||||
role: string
|
||||
}[]
|
||||
}[]
|
||||
| {
|
||||
expires_at: string
|
||||
/** Format: uuid */
|
||||
invite_id: string
|
||||
primary_email: string
|
||||
user_id: null
|
||||
user_roles: {
|
||||
allowed_networks?: {
|
||||
allowed_cidrs?: {
|
||||
/** Format: cidrv4 */
|
||||
cidr: string
|
||||
}[]
|
||||
allowed_cidrs_v6?: {
|
||||
/** Format: cidrv6 */
|
||||
cidr: string
|
||||
}[]
|
||||
}
|
||||
branches_only?: boolean
|
||||
expires_at?: number
|
||||
role: string
|
||||
}[]
|
||||
}
|
||||
)[]
|
||||
}
|
||||
LegacyApiKeysResponse: {
|
||||
enabled: boolean
|
||||
|
||||
Reference in new issue
Block a user