Giter Site home page Giter Site logo

Comments (3)

qnsi avatar qnsi commented on August 24, 2024

1. Add new policy on basejump.accounts

"Account can be deleted by primary owner" with check " (primary_owner_user_id = auth.uid())"

2. Expose basejump scheme from API

Go to settings -> Api -> Exposed schema and add basejump here

!! Warning, make sure your policies are correct. I did only a brief check and it seems basejump has sane defaults, but the risk is on you.

3. Query from client using basejump and not public schema

      const { data, error } = await supabase
        .schema("basejump")
        .from("accounts")
        .delete()
        .eq("id", workspaceId);

from basejump.

airsherlock avatar airsherlock commented on August 24, 2024

We do not wish to expose the entire basejump schema public as mentioned above.

Is there a function / rest api to delete the team?

from basejump.

vbylen avatar vbylen commented on August 24, 2024

@airsherlock I think you'd have to write the function yourself.

Something like this:

**
  Allows an owner to delete an existing account
 */

create or replace function public.delete_account(account_id uuid)
    returns void
    language plpgsql
as
$$
begin
    -- verify account owner for the account
    if basejump.has_role_on_account(
               delete_account.account_id, 'owner') <>
       true then
        raise exception 'Only account owners can delete accounts';
    end if;

    delete from basejump.accounts where id = delete_account.account_id;
end
$$;

grant execute on function public.delete_account(uuid) to authenticated;

from basejump.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.