feat: profiles and /set profile, and id cards
* New functionality to set meta data on businesscards. * Can develop a user profile. * Business cards link to user profile.
This commit is contained in:
parent
cd8dfb94a3
commit
710985638f
35 changed files with 4932 additions and 435 deletions
|
|
@ -337,6 +337,58 @@ CREATE POLICY auth_inventory_view ON auth.inventory
|
|||
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON auth.inventory TO chattyness_app;
|
||||
|
||||
-- auth.user_contacts
|
||||
ALTER TABLE auth.user_contacts ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Full access to own contacts
|
||||
CREATE POLICY auth_user_contacts_own ON auth.user_contacts
|
||||
FOR ALL TO chattyness_app
|
||||
USING (user_id = public.current_user_id())
|
||||
WITH CHECK (user_id = public.current_user_id());
|
||||
|
||||
-- Visibility-based SELECT for other users' contacts (uses parent user's contacts_visibility)
|
||||
CREATE POLICY auth_user_contacts_view ON auth.user_contacts
|
||||
FOR SELECT TO chattyness_app
|
||||
USING (
|
||||
user_id = public.current_user_id()
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM auth.users u WHERE u.id = user_contacts.user_id
|
||||
AND (
|
||||
u.contacts_visibility = 'public'
|
||||
OR (u.contacts_visibility = 'members' AND public.current_user_id() IS NOT NULL)
|
||||
OR (u.contacts_visibility = 'friends' AND auth.are_friends(u.id, public.current_user_id()))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON auth.user_contacts TO chattyness_app;
|
||||
|
||||
-- auth.user_organizations
|
||||
ALTER TABLE auth.user_organizations ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Full access to own organizations
|
||||
CREATE POLICY auth_user_organizations_own ON auth.user_organizations
|
||||
FOR ALL TO chattyness_app
|
||||
USING (user_id = public.current_user_id())
|
||||
WITH CHECK (user_id = public.current_user_id());
|
||||
|
||||
-- Visibility-based SELECT for other users' organizations (uses parent user's organizations_visibility)
|
||||
CREATE POLICY auth_user_organizations_view ON auth.user_organizations
|
||||
FOR SELECT TO chattyness_app
|
||||
USING (
|
||||
user_id = public.current_user_id()
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM auth.users u WHERE u.id = user_organizations.user_id
|
||||
AND (
|
||||
u.organizations_visibility = 'public'
|
||||
OR (u.organizations_visibility = 'members' AND public.current_user_id() IS NOT NULL)
|
||||
OR (u.organizations_visibility = 'friends' AND auth.are_friends(u.id, public.current_user_id()))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON auth.user_organizations TO chattyness_app;
|
||||
|
||||
-- auth.avatars
|
||||
ALTER TABLE auth.avatars ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue