-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow anon to see all profiles
Signed-off-by: Raphael Arce <[email protected]>
- Loading branch information
1 parent
5e6e908
commit 3f03928
Showing
2 changed files
with
10 additions
and
4 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
supabase/migrations/20241011145739_allow_anon_profile_select.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
create policy "Enable read access for all users" | ||
on "public"."profiles" | ||
as PERMISSIVE | ||
for SELECT | ||
to public | ||
using (true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,16 +15,16 @@ describe("profiles table", () => { | |
await deleteUsers([users.userId1, users.userId2]); | ||
}); | ||
|
||
it("should return no profiles when user is not logged in", async () => { | ||
it("should return all profiles when user is not logged in", async () => { | ||
const { data, error } = await supabaseAnonClient | ||
.from("profiles") | ||
.select("*"); | ||
expect(error).toBeNull(); | ||
expect(data).toBeDefined(); | ||
expect(data!.length).toBe(0); | ||
expect(data!.length).toBe(2); | ||
}); | ||
|
||
it("should return user's own profile when user is logged in", async () => { | ||
it("should return all profiles when user is logged in", async () => { | ||
const { data: data1, error: error1 } = | ||
await supabaseAnonClient.auth.signInWithPassword({ | ||
email: "[email protected]", | ||
|
@@ -38,6 +38,6 @@ describe("profiles table", () => { | |
.select("*"); | ||
expect(error).toBeNull(); | ||
expect(data).toBeDefined(); | ||
expect(data!.length).toBe(1); | ||
expect(data!.length).toBe(2); | ||
}); | ||
}); |