fix: rls not allowing invite member
This commit is contained in:
@@ -89,19 +89,8 @@
|
|||||||
throw 'Unable to create profile';
|
throw 'Unable to create profile';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update member response
|
|
||||||
const updateMemberRes = await supabase
|
|
||||||
.from('organizationmember')
|
|
||||||
.update({
|
|
||||||
verified: true,
|
|
||||||
profile_id: profile.id
|
|
||||||
})
|
|
||||||
.match({ email: data.invite.email, organization_id: data.invite.currentOrg?.id });
|
|
||||||
|
|
||||||
console.log('Update member response', updateMemberRes);
|
|
||||||
|
|
||||||
const res = await supabase.auth.signInWithPassword({
|
const res = await supabase.auth.signInWithPassword({
|
||||||
email: data.invite.email,
|
email: profile.email,
|
||||||
password: fields.password
|
password: fields.password
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -109,9 +98,19 @@
|
|||||||
throw res.error;
|
throw res.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update member response
|
||||||
|
const updateMemberRes = await supabase
|
||||||
|
.from('organizationmember')
|
||||||
|
.update({
|
||||||
|
verified: true,
|
||||||
|
profile_id: profile.id
|
||||||
|
})
|
||||||
|
.match({ email: profile.email, organization_id: data.invite.currentOrg?.id });
|
||||||
|
|
||||||
|
console.log('Update member response', updateMemberRes);
|
||||||
|
|
||||||
formRef?.reset();
|
formRef?.reset();
|
||||||
|
|
||||||
console.log({ path: $currentOrgPath });
|
|
||||||
return goto($currentOrgPath);
|
return goto($currentOrgPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|||||||
@@ -1060,6 +1060,16 @@ to public
|
|||||||
using (is_org_admin())
|
using (is_org_admin())
|
||||||
with check (is_org_admin());
|
with check (is_org_admin());
|
||||||
|
|
||||||
|
create policy "Only user can update their account via email"
|
||||||
|
on "public"."organizationmember"
|
||||||
|
as PERMISSIVE
|
||||||
|
for UPDATE
|
||||||
|
to public
|
||||||
|
using (
|
||||||
|
(select auth.jwt()) ->> 'email' = email
|
||||||
|
with check (
|
||||||
|
(select auth.jwt()) ->> 'email' = email
|
||||||
|
);
|
||||||
|
|
||||||
create policy "Only auth users can read profile"
|
create policy "Only auth users can read profile"
|
||||||
on "public"."profile"
|
on "public"."profile"
|
||||||
|
|||||||
Reference in New Issue
Block a user