BE: Prevent deletion of groups/namespaces when they have a subscription

Original issue: #1273 (closed)

Problem

The deletion of groups/namespaces with linked subscriptions are creating inconsistencies between GitLab and the Customers Portal. The linked group/namespace can't be fetched on the Customers Portal side on update like changing namespace and results in an error (500).

Proposal

Prevent groups/namespaces from being deleted when they have a subscription. A group/namespace has to be disassociated from any linked subscriptions before deletion.

It should also be checked what happens to a subscription when a group gets transferred. The current assumption is that the subscription does not change.

Design

See UX issue

Result

Keep data between GitLab and Customers portal in sync.

Next steps (if any)

  • Disable the Delete group button when deleting a group
  • Add an info text about disassociating any subscriptions first
  • Prevent deletion in the backend

How will we measure success?

No error on the Customers Portal side because of deleted groups/namespaces in subscriptions.

Edited by Amanda Rueda