I ended up doing this in the controller for the model I needed to filter (based on the logged user) :
public function listExtendQuery($query, $definition = null) {
$user = BackendAuth::getUser();
$dealers = scopeAuthorizedDealers($query, $user);
$query->whereIn('dealer_id', $dealers)->get();
}
In the documentation, I can find info about local scope and dynamic scope but nothing about global scope. I don’t know if it could be something good to get there… ?
Because with the solution above, you have to be careful to update and manage access in the update.htm (if somebody changes the recordId manually). You have to check that too.