This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » General » How to hide a link if use does not...
expandshrink

How to hide a link if use does not have permission?

How to hide a link if use does not have permission?

Saturday 13 July 2013 12:17:56 am - 3 replies

I have added a link under Home. This link automatically shows in the left nav menu as I want. But I want it only to show if a user has access to the module/function the link points to.

Is there a way to handle this or do I have to hard code it in the template?

Another way to put the question:

What is the best way to add a link to a module/function in the nav menu and have it display according to user permissions?

Saturday 13 July 2013 2:16:04 pm

I think you're looking for (something like) this - but be careful with caching - otherwise everyone gets the permissions from whomever happened to generate the cache:

 {def $notification_access=fetch( 'user', 'has_access_to', hash( 'module', 'notification', 'function', 'addtonotification' ) )}

Saturday 13 July 2013 3:32:16 pm

This may work of the link being hard coded but I am looking for a solution for when a link is added by adding a "link" content type to the folder.

Thanks for your input.

Monday 15 July 2013 11:00:19 pm

Silly me.  Just had to assign it to a restricted section.  oops

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from