about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gn_auth/auth/authorisation/resources/groups/models.py10
-rwxr-xr-xsetup.py2
2 files changed, 9 insertions, 3 deletions
diff --git a/gn_auth/auth/authorisation/resources/groups/models.py b/gn_auth/auth/authorisation/resources/groups/models.py
index 597ac37..a1937ce 100644
--- a/gn_auth/auth/authorisation/resources/groups/models.py
+++ b/gn_auth/auth/authorisation/resources/groups/models.py
@@ -690,10 +690,16 @@ def delete_group(conn: db.DbConnection, group_id: UUID):
         sqlite3.IntegrityError: if the group has members or linked resources, or
         both.
     """
+    rsc = group_resource(conn, group_id)
     with db.cursor(conn) as cursor:
         cursor.execute("DELETE FROM group_join_requests WHERE group_id=?",
                        (str(group_id),))
-        cursor.execute("DELETE FROM group_resources WHERE group_id=?",
-                       (str(group_id),))
+        cursor.execute("DELETE FROM user_roles WHERE resource_id=?",
+                       (str(rsc.resource_id),))
+        cursor.execute(
+            "DELETE FROM group_resources WHERE group_id=? AND resource_id=?",
+            (str(group_id), str(rsc.resource_id)))
+        cursor.execute("DELETE FROM resources WHERE resource_id=?",
+                       (str(rsc.resource_id),))
         cursor.execute("DELETE FROM groups WHERE group_id=?",
                        (str(group_id),))
diff --git a/setup.py b/setup.py
index 77e5eb3..59cd86f 100755
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ setup(author="Frederick M. Muriithi",
           "pymonad",
           "redis>=3.5.3",
           "requests>=2.25.1",
-          "flask-cors>=3.0.9",
+          "flask-cors", # with the `>=3.0.9` specification, it breaks the build
           "gn-libs>=0.0.0"
       ],
       include_package_data=True,