how to implement "if/else" with <vs:isUserInRole role="Administrator">

Viewpoint
Teradata Employee

how to implement "if/else" with <vs:isUserInRole role="Administrator">

Hi,

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"...

Thanks,
Bilal
2 REPLIES
Teradata Employee

Re: how to implement "if/else" with <vs:isUserInRole role="Administrator">

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: http://developer.teradata.com/viewpoint/reference/viewpoint-portlet-security.

Teradata Employee

Re: how to implement "if/else" with <vs:isUserInRole role="Administrator">

Hi Stever,

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