iloom-flatten/migrations/20260523_162456_create_profiles_rls.sql

25 lines
717 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ============================================
-- 此文件由 Meoo Cloud 自动生成,请勿修改
-- This file is auto-generated by Meoo Cloud, DO NOT MODIFY
-- ============================================
-- profiles 表 RLS 策略
-- 用户可以查看自己公司的所有成员资料
CREATE POLICY users_select_company_profiles ON public.profiles
FOR SELECT USING (
company_id = public.get_user_master_company_id()
OR id = auth.uid()
);
-- 用户可以修改自己的资料
CREATE POLICY users_update_own_profile ON public.profiles
FOR UPDATE USING (
id = auth.uid()
);
-- 允许创建 profile注册时需要
CREATE POLICY users_insert_profile ON public.profiles
FOR INSERT WITH CHECK (true);