createSQLStatementForCreatePolicy() — supabase Function Reference
Architecture documentation for the createSQLStatementForCreatePolicy() function in Policies.utils.ts from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD ef460339_41b1_8cbe_f6ee_dc2f1aa55216["createSQLStatementForCreatePolicy()"] 985f2d7f_95ed_bd41_d27b_4f31564dcf82["createSQLPolicy()"] 985f2d7f_95ed_bd41_d27b_4f31564dcf82 -->|calls| ef460339_41b1_8cbe_f6ee_dc2f1aa55216 style ef460339_41b1_8cbe_f6ee_dc2f1aa55216 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/studio/components/interfaces/Auth/Policies/Policies.utils.ts lines 66–79
const createSQLStatementForCreatePolicy = (policyFormFields: PolicyFormField): PolicyForReview => {
const { name, definition, check, command, schema, table } = policyFormFields
const roles = policyFormFields.roles.length === 0 ? ['public'] : policyFormFields.roles
const description = `Add policy for the ${command} operation under the policy "${name}"`
const statement = [
`CREATE POLICY "${name}" ON "${schema}"."${table}"`,
`AS PERMISSIVE FOR ${command}`,
`TO ${roles.join(', ')}`,
`${definition ? `USING (${definition})` : ''}`,
`${check ? `WITH CHECK (${check})` : ''}`,
].join('\n')
return { description, statement }
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does createSQLStatementForCreatePolicy() do?
createSQLStatementForCreatePolicy() is a function in the supabase codebase.
What calls createSQLStatementForCreatePolicy()?
createSQLStatementForCreatePolicy() is called by 1 function(s): createSQLPolicy.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free