backpack1098B
Convex Community3y ago
17 replies
backpack1098

i am defeated by RLS

hello team, can y'all pls help me understand how to do RLS? i currently have a func,
export const getCustomer = query(
  withQueryRLS(async (ctx, { customerId }) => {
    return await ctx.db.get(customerId)
  })
)

with the rls func defined as below
const { withQueryRLS } = RowLevelSecurity<
  {
    customer: Doc<"customer">
  },
  DataModel
>({
  customer: {
    read: async (ctx) =>
      await hasPermission({
        ctx,
        permissionName: "customer",
        operation: "read",
      }),
  },
})
Was this page helpful?