I want to control the access of a page based on the user ID and the value of some other fields.
For example, if I am logged in as user #5, I have access to user/5
but I don't have user to the page user/6
and administrator users have access to both pages.
In my case, imagine I have a custom user page and I want to give access only to the owner and to the user selected in a custom field.
I don't think I can achieve that using permissions and in the future I might have more restrictions based on the value of other fields. So ideally, I would like to have a function where I will get the uid and the value of the fields, I will do my checks and I will restrict the access or not.
By the way my pages are panel pages not nodes.
Any idea/help/suggestion?