I`m trying to make the following:
User has the ability to edit sku attibutes, but cant edit prices and inventories (we receive them from another system).
I`ve already read https://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2015/6/read-only-catalog/
and https://vimvq1987.com/read-catalog-ui-part-1/, but it seems that this approach is not working for prices and stocks.
There are several ways to do it, but there is no perfect way. You can simply implement IPriceDetailService and IInventoryService and only allows editing for special account (for example, the "integration account") - or no editing at all.
The ability to set access rights for prices and inventory is a feature in our backlog, but it will not happen anytime soon.
Yes, something like that, you can always check the current user.
If I understand it correctly, you want to disable the Pricing and Inventories views? You would still be able to see the prices and invetories on the tabs in the All Properties view, but not edit them, since they are read only there.
Would an approach like this work?
I wanna remove or at least disable "Edit inventories" link(which is under the sku`s inventories table).
Good point, I didn't consider that. Just did a quick check even if the view is disabled the "Edit" link under the table is still there. Nothing will happen when you click on it, but I understand why you'd want to remove or disable it.
I noticed one interesting thing:
1) I opened sku edit view with admin account=> all properties are editable, "Edit prices" and "Edit inventories" are in place.
2) Then I copied this tab and logged out.
3) Logged in as user without access to this catalog.
4) Referesh first tab => all properties are disabled, and !!! there are no "Edit prices" and "Edit inventories" links in corresponding tabs, only tables.
So the problem is that I cant find the logic, why these links are supposed to be hidden in case of insufficient rights.
May be it`s possible to override something on C# code?