update another collection from a custom hook Directus

Viewed 292

Good afternoon colleagues ...

I need to be able to update another collection from a custom hook, The following happens that if I use ItemsService or TableGatewayFactory it uses the acl of the container ... in this case the user will be from a customer role, but this does not have the permission to edit orders, I would like to keep it that way ...

It doesn't matter if I have to update the item with another user using their token, or any other alternative ...

Thanks in advance....

'item.update.transactionlog' => function ($data) { <br>
   $container = Application::getInstance()->getContainer(); <br>
   $itemsService = new \Directus\Services\ItemsService($container);<br>
   $acl = $container->get('acl');<br>
   $params = [];<br>
   $orden = ['status' => 'paid'];<br>
   $orderUpdate = $itemsService->update('orders', $data['orderid'], $orden, $params);<br>
}
0 Answers
Related