MCPcopy Index your code
hub / github.com/simstudioai/sim / mergeEnvAllowlist

Function mergeEnvAllowlist

apps/sim/ee/access-control/utils/permission-check.ts:108–127  ·  view source on GitHub ↗

* Merges the env allowlist into a permission config. * If `config` is null and no env allowlist is set, returns null. * If `config` is null but env allowlist is set, returns a default config with only allowedIntegrations set. * If both are set, intersects the two allowlists.

(config: PermissionGroupConfig | null)

Source from the content-addressed store, hash-verified

106 * If both are set, intersects the two allowlists.
107 */
108function mergeEnvAllowlist(config: PermissionGroupConfig | null): PermissionGroupConfig | null {
109 const envAllowlist = getAllowedIntegrationsFromEnv()
110
111 if (envAllowlist === null) {
112 return config
113 }
114
115 if (config === null) {
116 return { ...DEFAULT_PERMISSION_GROUP_CONFIG, allowedIntegrations: envAllowlist }
117 }
118
119 const merged =
120 config.allowedIntegrations === null
121 ? envAllowlist
122 : config.allowedIntegrations
123 .map((i) => i.toLowerCase())
124 .filter((i) => envAllowlist.includes(i))
125
126 return { ...config, allowedIntegrations: merged }
127}
128
129/**
130 * The permission group that governs a user in a given context, with its parsed

Callers 5

getUserPermissionConfigFunction · 0.85
getPermissionConfigFunction · 0.85
validateBlockTypeFunction · 0.85
assertPermissionsAllowedFunction · 0.85

Calls 1

Tested by

no test coverage detected