Hi,
It is possible to achieve this through record rules. You can create seperate group for each warehouse and to these groups you can give the necessary record rule. In your example, lets consider user A and warehouse A - define a group "Warehouse-A Access". Define a record rule say "Warehouse A restrictions" on the model 'Warehouse' and define the rule as [('id','=',1)] (here I'm assuming the id of wh A as 1). Assign this record rule to the group 'Warehouse-A Access'. This will restrict the user A to only warehouse A.
You need to ensure that there are no other groups/rules which will override this access to give the user access to other warehouses.
Perhaps, this module - https://apps.odoo.com/apps/modules/15.0/stock_limitation/ - will be of use to you