Skip to content

Commit

Permalink
fix: combined_grants_ext already shows only the authorized user's g…
Browse files Browse the repository at this point in the history
…rants, no need to filter by `user_id`

Problem is, `user_id` is null when showing grants that come from `role_grants`, such as `estuary_support`/.
  • Loading branch information
jshearer committed Oct 10, 2023
1 parent 74c1938 commit f1ed180
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion supabase/functions/billing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ serve(async (req) => {
throw new Error("User not found");
}

const grants = await supabaseClient.from("combined_grants_ext").select("*").eq("capability", "admin").eq("user_id", user.id);
const grants = await supabaseClient.from("combined_grants_ext").select("*").eq("capability", "admin");

if (!(grants.data ?? []).find((grant) => grant.object_role === requested_tenant)) {
res = [JSON.stringify({ error: `Not authorized to requested grant` }), {
Expand Down

0 comments on commit f1ed180

Please sign in to comment.