Hiding portlets with permissions?

Carsten Senger senger at bag-shi.de
Sun Apr 15 12:13:46 UTC 2007


Hi,

Larry Pitcher schrieb:
> Is there a way to limit who can see a portlet based on roles?

You should limit access with permissions, not roles, but you can do both.

In a PageTemplate you can do something like that:

tal:condition="python:checkPermission('Manage portal', here);"

checkPermission() is defined in the Membership-Tool.

To inspect roles on Users there are some methods like getRolesInContext() or 
has_role().

> 
> A site I'm working on has it's own navigation system, but it would be 
> good for managers / editors to be able to see the standard navigation 
> portlet, even though it would not be shown to regular visitors / members.
> 
> What's the best way to accomplish this? Do I need to customize the 
> portlet(s) in question, or is there an easier way?

You should customize portlet_navigation.


..Carsten




More information about the Product-Developers mailing list