All Forums Viewpoint
bilal.farooq 28 posts Joined 08/10
15 Jul 2011
how to implement "if/else" with <vs:isUserInRole role="Administrator">


I want to render portlet content only for "Administrator" "Role" and, render: "Access not allowed" for any other "Role".
What would be the best way to achieve this "if/else"...


stever 149 posts Joined 08/09
16 Jul 2011

This would not be the recommended way to control access to content in Viewpoint. Forcing a user to be in the Administrator role to obtain access to some content is a bad practice. Instead, you should declare a permission for your portlet that represents the content you wish to protect. This allows the customer to have a separate role by which they can control access to this content.

As for implementing if/else logic for checking permissions, you should probably use the VerdictManager in your Java controller code to determine if the user has access to the content. By the time you are in the JSP page, you should have to do little or no checking of user permissions.

You should look at the security section of the PDK if you haven't already done so:

bilal.farooq 28 posts Joined 08/10
18 Jul 2011

Hi Stever,

Thanks for the insight, will go through the material and ping you again if I need more help.

You must sign in to leave a comment.