SabaiSOP

Row-Level Security Setup Guide

Follow this checklist to properly secure your multi-tenant app data

Important: Complete in Base44 Dashboard

These rules must be set up in the Base44 dashboard, not in code.

  1. Open your Base44 dashboard
  2. Navigate to "Database" or "Entities" section
  3. Click on each entity listed below
  4. Look for "Security Rules", "Access Control", or "Row-Level Security"
  5. Add the specified rule for each entity
What RLS Does

Row-Level Security (RLS) ensures that users can only see and interact with data that belongs to their specific tenant (restaurant).

Without RLS, invited users might see data from other restaurants, or users might accidentally create new tenants instead of joining existing ones.

The rule tenant_id == user.tenant_id means: "Only show records where the record's tenant_id matches the logged-in user's tenant_id"

RLS Rules Checklist
SOP
tenant_id == user.tenant_id
SOPCollection
tenant_id == user.tenant_id
SOPTemplate
tenant_id == user.tenant_id
Checklist
tenant_id == user.tenant_id
ChecklistTemplate
tenant_id == user.tenant_id
Incident
tenant_id == user.tenant_id
IncidentForm
tenant_id == user.tenant_id
Staff
tenant_id == user.tenant_id
Department
tenant_id == user.tenant_id
Form
tenant_id == user.tenant_id
FormSubmission
tenant_id == user.tenant_id
Quiz
tenant_id == user.tenant_id
QuizCollection
tenant_id == user.tenant_id
QuizAttempt
tenant_id == user.tenant_id
StaffInvitation
tenant_id == user.tenant_id
TenantSpecial Case
id == user.tenant_id

Users can only see their own tenant record

After Setup

Once all RLS rules are configured:

  • Invited users will only see data for their restaurant
  • Users cannot accidentally access other tenants' data
  • Multi-tenant architecture will be properly secured
  • Team members will appear in "Team Access" for the correct tenant