diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index a9b44d50..b9c3a659 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -141,6 +141,7 @@ class ErasureListView(DeviceListMixin): ) if orphans: schema = app.config.get('SCHEMA') + _user = g.user.id sql = f""" select action.id from {schema}.action as action inner join {schema}.erase_basic as erase @@ -149,7 +150,8 @@ class ErasureListView(DeviceListMixin): on device.id=action.parent_id inner join {schema}.placeholder as placeholder on placeholder.binding_id=device.id - where action.parent_id is null or placeholder.kangaroo=true + where (action.parent_id is null or placeholder.kangaroo=true) + and action.author_id='{_user}' """ ids = (e[0] for e in db.session.execute(sql)) erasure = (