diff --git a/muranoapi/api/v1/catalog.py b/muranoapi/api/v1/catalog.py index 2bb2ca89..27249bba 100644 --- a/muranoapi/api/v1/catalog.py +++ b/muranoapi/api/v1/catalog.py @@ -210,7 +210,7 @@ class Controller(object): return package.archive def delete(self, req, package_id): - db_api.package_delete(package_id) + db_api.package_delete(package_id, req.context) def show_categories(self, req): categories = db_api.categories_list() diff --git a/muranoapi/db/catalog/api.py b/muranoapi/db/catalog/api.py index 23e41f4e..21a136ab 100644 --- a/muranoapi/db/catalog/api.py +++ b/muranoapi/db/catalog/api.py @@ -391,15 +391,16 @@ def package_upload(values, tenant_id): return package -def package_delete(package_id): +def package_delete(package_id, context): """ Delete package information from the system ID of a package, string parameters to update """ session = db_session.get_session() + with session.begin(): package = session.query(models.Package).get(package_id) - + _authorize_package(package, context) session.delete(package)