Skip to content

Commit b7032b4

Browse files
author
Tobias Fuhrimann
committed
Handle auto-confirm case of invitations
1 parent 163dda5 commit b7032b4

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

invite_billing_account_user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (p *AppCloudPlugin) InviteBillingAccountUser(c plugin.CliConnection, invite
5454
return errors.New("Couldn't read JSON response from server")
5555
}
5656

57-
if res.Entity.Status != "SENT" {
57+
if res.Entity.Status != "SENT" && res.Entity.Status != "CONFIRMED" {
5858
return fmt.Errorf("Couldn't send invitation. Current status: %s", res.Entity.Status)
5959
}
6060

invite_org_user.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ func (p *AppCloudPlugin) InviteOrgUser(c plugin.CliConnection, invitee string, o
3535
OrgID: o.Guid,
3636
Roles: strings.Split(roles, ","),
3737
}
38+
if len(args.Roles) == 1 && args.Roles[0] == "" {
39+
args.Roles = []string{}
40+
}
3841
argsData, err := json.Marshal(args)
3942
if err != nil {
4043
return fmt.Errorf("Couldn't parse JSON data")
@@ -54,7 +57,7 @@ func (p *AppCloudPlugin) InviteOrgUser(c plugin.CliConnection, invitee string, o
5457
return errors.New("Couldn't read JSON response from server")
5558
}
5659

57-
if res.Entity.Status != "SENT" {
60+
if res.Entity.Status != "SENT" && res.Entity.Status != "CONFIRMED" {
5861
return fmt.Errorf("Couldn't send invitation. Current status: %s", res.Entity.Status)
5962
}
6063

invite_space_user.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ func (p *AppCloudPlugin) InviteSpaceUser(c plugin.CliConnection, invitee string,
3535
SpaceID: s.Guid,
3636
Roles: strings.Split(roles, ","),
3737
}
38+
if len(args.Roles) == 1 && args.Roles[0] == "" {
39+
args.Roles = []string{}
40+
}
3841
argsData, err := json.Marshal(args)
3942
if err != nil {
4043
return errors.New("Couldn't parse JSON data")
@@ -54,7 +57,7 @@ func (p *AppCloudPlugin) InviteSpaceUser(c plugin.CliConnection, invitee string,
5457
return errors.New("Couldn't read JSON response from server")
5558
}
5659

57-
if res.Entity.Status != "SENT" {
60+
if res.Entity.Status != "SENT" && res.Entity.Status != "CONFIRMED" {
5861
return fmt.Errorf("Couldn't send invitation. Current status: %s", res.Entity.Status)
5962
}
6063

0 commit comments

Comments
 (0)