# Parcel Empire — Row Level Security Guide

This guide explains the intended access model. Check the generated SQL against your live schema before production.

## Public read / owner write pattern

Most gameplay tables should allow public read where it improves the map experience, but writes should be restricted to the signed-in owner or controlled RPC functions.

Examples:

- `atlas_parcels`: readable by signed-in players; buying/transfers should use RPC functions.
- `atlas_wallets`: readable only by the wallet owner; writes should happen through server-side functions.
- `atlas_transactions`: readable only by the user involved; inserts should be from trusted functions.
- `atlas_payout_requests`: readable only by the requester and admins; status changes by admins only.
- `atlas_admins`: readable only by admins or tightly restricted.

## Do not trust browser values

Never trust client-side values for:

- cash balance
- payout eligibility
- parcel ownership
- marketplace transfers
- upgrade costs
- reward crediting

Use database functions/RPCs for those actions.
