How to allow only certain users access to certain fields of a node? I have product information on my site. Only some users can view pricing for certain suppliers. So each product has a supplier field, which is a node entity reference to an instance of a "supplier" content type.

When User A logs in, who only has access to Products Offered by Supplier B, he must only see the "cost price" of items that he is linked to. This link is currently accomplished using a Profile Field, which is private and set by administrators. 

What is the best way to now restricting users based on this relationship. The end result would be that certain users see the full node with the cost price, while others will see everything except the cost price.

How can I get this right?
Install Field Permission module. In this module you can set permission on every filed of content types for different roles.



You can also modify hook_field_display_alter  to check for the user and the field id and see if the user is allowed or not. you should copy this in to your template file.