1
votes

I m using Liferay 6.2. in Polls Display Portlet after question is answered the polls result is displayed for all users . can we restrict the polls results to only admin users.

i m aware that some minor customization is required in \html\portlet\polls_display\view.jsp file at line 94 in this line <%@ include file="/html/portlet/polls/view_question_results.jspf" %>. but not sure how to achieve the expected results. so, can anybody please help me how to achieve this.

thanks in advance

1
You can directly check on permissionChecker.isOmniadmin(), if you have access to permissionChecker object. Otherwise, you can use PortalUtil.isOmniadmin(long userId) using userId from User object.Parkash Kumar
You can extract User object from ThemeDisplay or use PortalUtil.getUser(HttpServletRequest request) / PortalUtil.getUser(PortletRequest portletRequest) if you have any request object.Parkash Kumar

1 Answers

1
votes

With the below code, one can restrict the Polls results to admin users only:

<c:choose>
    <c:when test="<%= PollsQuestionPermission.contains(permissionChecker, question, ActionKeys.UPDATE) %>">
        <%@ include file="/html/portlet/polls/view_question_results.jspf"%>
    </c:when>
    <c:otherwise>
        <br />
        <div>
            <b><i>Thank You For Your Response</i></b>
        </div>
    </c:otherwise>
</c:choose>