'Unlinking' a link for users without permission I have a link which goes to a page created by a custom module. The module implements hook_permission and hook_menu so that when a user without permission clicks the link they get sent to the page and are shown the 'You are not authorized to access this page' message.

Is there way I can 'unlink'/'de-anchor' the link, so that the link displays as just unclickable black text to those without permission?

Thanks
Here's what I've come up with myself. It works fine:

if(user_access('edit record')) {
    $link = l(t('Edit this record'), 'edit-record/' . $nid);
} else {
    $link = t('Edit this record');
}


If you know of a 'cleaner' more 'correct' way. Please let me know. Thanks