Display a link public space / private space


Is there a simple way to display a link to public space (say Home) when I am in a restricted access page ?
Something like
if (is_restricted) {
show homelink;
} else {
show member page link;

thank you for your help !

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.