Skip to content

Commit

Permalink
Add sponsor access to tables (fix sponsor portal check in listener) (#…
Browse files Browse the repository at this point in the history
…515)

* Add sponsor access to tables

* Oops

* Fix invalid sql syntax
  • Loading branch information
VictiniX888 authored Nov 2, 2023
1 parent 7745060 commit 79df1f8
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions supabase/migrations/20231101000000_add_sponsor_access_events.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
create or replace function get_sponsors()
returns setof uuid
language sql
security definer
set search_path = public
stable
as $$
select user_id
from user_profiles
where user_profiles.role = 3
$$;

create policy "Allow sponsors to access all rows"
on public.user_profiles
for select
to authenticated
using (auth.uid() in (
select get_sponsors()
));

create policy "Allow sponsors to access all rows"
on public.event_log
for select
to authenticated
using (auth.uid() in (
select get_sponsors()
));

create policy "Allow sponsors to access all rows"
on public.events
for select
to authenticated
using (auth.uid() in (
select get_sponsors()
));

create policy "Allow sponsors to access all rows"
on public.participants
for select
to authenticated
using (auth.uid() in (
select get_sponsors()
));

7 comments on commit 79df1f8

@vercel
Copy link

@vercel vercel bot commented on 79df1f8 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

pointr – ./

pointr.vercel.app
www.hack.sc
pointr-git-main-hacksc.vercel.app
pointr-hacksc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 79df1f8 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

recruitment – ./

recruitment-hacksc.vercel.app
recruitment-git-main-hacksc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 79df1f8 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

www-2023 – ./

www-2023-hacksc.vercel.app
www-2023-git-main-hacksc.vercel.app
www-2023.vercel.app
2023.hacksc.com

@vercel
Copy link

@vercel vercel bot commented on 79df1f8 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

interim – ./

interim-git-main-hacksc.vercel.app
interim-hacksc.vercel.app
www.socalhacks.org
socalhacks.org

@vercel
Copy link

@vercel vercel bot commented on 79df1f8 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 79df1f8 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 79df1f8 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sso – ./

sso-hacksc.vercel.app
sso.hacksc.com
sso-steel.vercel.app
sso-git-main-hacksc.vercel.app

Please sign in to comment.