Skip to content

Commit 8ae1211

Browse files
authored
feat(org): prevent from leaving current organization (#457)
Signed-off-by: Mattia Buccarella <[email protected]>
1 parent 94aa6e2 commit 8ae1211

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/cli/cmd/organization_leave.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package cmd
1717

1818
import (
1919
"context"
20+
"errors"
2021
"fmt"
2122

2223
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
@@ -53,6 +54,10 @@ func newOrganizationLeaveCmd() *cobra.Command {
5354
return fmt.Errorf("organization %s not found", orgID)
5455
}
5556

57+
if membership.Current {
58+
return errors.New("can't leave the `current` organization. To leave this org, please switch to another one")
59+
}
60+
5661
fmt.Printf("You are about to leave the organization %q\n", membership.Org.Name)
5762

5863
// Ask for confirmation

0 commit comments

Comments
 (0)