Filtering based on tags in permissions

Hi,
How to give permissions in roles on the basis of tags. So tht, tht role can only view these devices.
thanks