How to hide Vertical Side bar if user has no menu link in it?

Hello,If a user has access only to links in the nav bar , meaning the side bar has no menu listed for a specific user role, how can remove or hide the side bar base on this condition?if all menus are in the nav bar, it works great (no side bar).But I need to allow some user roles to have the side bar.Thank you for your support

Similar to https://discourse.hkvstore.com/t/turn-off-horizontal-menu/8236/1