Inaccessible asset files of deactivated contents

Hi Sebastian,

When a content is deactivated(draft or archived), I want it to be inaccessible in the asset files used in that content.

Is there an easy way to achieve this?

Thank you.

You want to delete all assets that are referenced by a content item?

You have to implement it in a custom webhook.

Can you show me an example?

So can I do this directly on squidex?

It is not possible in Squidex directly. Therefore you need a rule that triggers a custom webhook.

But this is kind of pseudo code:

app.Listen(80);

const client = createClientToSquidex();

app.Map('POST', async request => {
   var data = request.data;
 
   for (var id in data.assets.iv) {
       await client.assets.delete(request.appName, id);
   }
});

I could also introduce a method for deleteAsset to make this happen. Then you can use a script rule for that.

1 Like

Actually it would be great. Maybe it will be useful to someone else later.
Can you add this and send an example with it?

Thank you.