MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / membershipFromOrg

Function membershipFromOrg

app/cli/cmd/organization_leave.go:27–40  ·  view source on GitHub ↗

Get the membership entry associated to the current user for the given organization

(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

25
26// Get the membership entry associated to the current user for the given organization
27func membershipFromOrg(ctx context.Context, name string) (*action.MembershipItem, error) {
28 memberships, err := action.NewMembershipList(ActionOpts).ListOrgs(ctx)
29 if err != nil {
30 return nil, fmt.Errorf("listing memberships: %w", err)
31 }
32
33 for _, m := range memberships {
34 if m.Org.Name == name {
35 return m, nil
36 }
37 }
38
39 return nil, fmt.Errorf("organization %s not found", name)
40}
41
42func newOrganizationLeaveCmd() *cobra.Command {
43 var orgName string

Callers 2

newOrganizationSetFunction · 0.85
newOrganizationLeaveCmdFunction · 0.85

Calls 2

NewMembershipListFunction · 0.92
ListOrgsMethod · 0.80

Tested by

no test coverage detected