Skip to content

Commit 8dab150

Browse files
committed
normalize to lower case
1 parent f75e82d commit 8dab150

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

apps/sim/ee/access-control/utils/permission-check.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ function mergeEnvAllowlist(config: PermissionGroupConfig | null): PermissionGrou
8686
const merged =
8787
config.allowedIntegrations === null
8888
? envAllowlist
89-
: config.allowedIntegrations.filter((i) => envAllowlist.includes(i))
89+
: config.allowedIntegrations
90+
.map((i) => i.toLowerCase())
91+
.filter((i) => envAllowlist.includes(i))
9092

9193
return { ...config, allowedIntegrations: merged }
9294
}

apps/sim/hooks/use-permission-config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function useAllowedIntegrationsFromEnv() {
4545
function intersectAllowlists(a: string[] | null, b: string[] | null): string[] | null {
4646
if (a === null) return b
4747
if (b === null) return a
48-
return a.filter((i) => b.includes(i))
48+
return a.map((i) => i.toLowerCase()).filter((i) => b.includes(i))
4949
}
5050

5151
export function usePermissionConfig(): PermissionConfigResult {
@@ -82,7 +82,7 @@ export function usePermissionConfig(): PermissionConfigResult {
8282
return (blockType: string) => {
8383
if (blockType === 'start_trigger') return true
8484
if (mergedAllowedIntegrations === null) return true
85-
return mergedAllowedIntegrations.includes(blockType)
85+
return mergedAllowedIntegrations.includes(blockType.toLowerCase())
8686
}
8787
}, [mergedAllowedIntegrations])
8888

@@ -97,7 +97,9 @@ export function usePermissionConfig(): PermissionConfigResult {
9797
return <T extends { type: string }>(blocks: T[]): T[] => {
9898
if (mergedAllowedIntegrations === null) return blocks
9999
return blocks.filter(
100-
(block) => block.type === 'start_trigger' || mergedAllowedIntegrations.includes(block.type)
100+
(block) =>
101+
block.type === 'start_trigger' ||
102+
mergedAllowedIntegrations.includes(block.type.toLowerCase())
101103
)
102104
}
103105
}, [mergedAllowedIntegrations])

0 commit comments

Comments
 (0)