14a32bdc0d
- Unified monorepo with backend (Express), frontend (Next.js), and devops - Backend: ESLint, Prettier, Jest tests (3 passing), health endpoint, .env.example - Frontend: Fixed build errors, fixed all lint errors (0 remaining), tests passing - DevOps: Docker Compose with PostgreSQL, backend, frontend + healthchecks - CI/CD: 3 GitHub Actions workflows (backend, frontend, docker integration) - DX: Husky pre-commit hooks with smart change detection - Docs: Root README with architecture, CONTRIBUTING.md, PR template Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
22 lines
761 B
SQL
22 lines
761 B
SQL
-- Fix RLS policies for users table to allow proper user details loading
|
|
-- Add policies for SELECT operations on users table
|
|
|
|
-- Allow users to select their own profile
|
|
CREATE POLICY "Users can select their own profile" ON public.users
|
|
FOR SELECT USING (auth.uid() = id);
|
|
|
|
-- Allow users to select profiles in their organization
|
|
CREATE POLICY "Users can select profiles in their organization" ON public.users
|
|
FOR SELECT USING (
|
|
organization_id IN (
|
|
SELECT organization_id FROM public.users WHERE id = auth.uid()
|
|
)
|
|
);
|
|
|
|
-- Allow service role to select any user (for admin operations)
|
|
CREATE POLICY "Service role can select any user" ON public.users
|
|
FOR SELECT USING (auth.role() = 'service_role');
|
|
|
|
-- Refresh schema cache
|
|
NOTIFY pgrst, 'reload schema';
|