I have been reading about giving data access from a smart contract, but I could not find good and precise documentation/information about that. I would like to make a smart contract where a user gives access to its data to another one.

Could anyone explain to me how it works? Where can I find good information about that? Is there any example of a smart contract which gives data access?