Skip to content

Commit

Permalink
Prevent deletion of groups linked to network resource
Browse files Browse the repository at this point in the history
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
  • Loading branch information
bcmmbaga committed Dec 27, 2024
1 parent f07e19f commit 9f435f4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions management/server/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ func validateDeleteGroup(ctx context.Context, transaction store.Store, group *ty
return status.Errorf(status.InvalidArgument, "deleting group ALL is not allowed")
}

if len(group.Resources) > 0 {
return &GroupLinkError{"network resource", group.Resources[0].ID}
}

if isLinked, linkedRoute := isGroupLinkedToRoute(ctx, transaction, group.AccountID, group.ID); isLinked {
return &GroupLinkError{"route", string(linkedRoute.NetID)}
}
Expand Down

0 comments on commit 9f435f4

Please sign in to comment.