0

如何在 Jasper Server UI 主页上禁用/隐藏用户的注销链接?

4

1 回答 1

2

jasperserver\WEB-INF\decorators\decoratorCommonComponents.jsp您可以为此目的修改文件。

此 jsp 文件的片段演示了如果用户不处于 ADMINISTRATOR 角色时如何隐藏注销链接:

<%--
***********************************************************************
authorization for logged in user
***********************************************************************
--%>
<ul id="metaLinks" class="horizontal">
    <li id="userID">
        <authz:authorize ifNotGranted="ROLE_ANONYMOUS">
            <span id="casted">
                <c:if test="<%= com.jaspersoft.jasperserver.api.metadata.user.service.impl.UserAuthorityServiceImpl.isUserSwitched() %>">
                    <%= ((com.jaspersoft.jasperserver.api.metadata.user.domain.User)
                          com.jaspersoft.jasperserver.api.metadata.user.service.impl.UserAuthorityServiceImpl.
                          getSourceAuthentication().getPrincipal()).getFullName() %>
                    <spring:message code="jsp.main.as"/>
                </c:if>
            </span>
            <authz:authentication property="principal.fullName"/>
        </authz:authorize>
    </li>
    <c:set var="isShowHelp" scope="page"><%= WebHelpLookup.getInstance().isShowHelpTrue() %></c:set>
    <c:if test="${isProVersion && isShowHelp}"><li id="help"><a href="#" id="helpLink"><spring:message code="decorator.helpLink"/></a></li></c:if>\
    <%-- We allow the logout link only for users in ROLE_ADMINISTRATOR role --%>
    <authz:authorize ifAnyGranted="ROLE_ADMINISTRATOR">
        <li id="main_logOut" class="last"><a id="main_logOut_link" href="#" onclick="javascript:return false;"><spring:message code="menu.logout"/></a></li>
    </authz:authorize>
</ul>

我在这个 jsp 中添加了注销链接<authz:authorize ifAnyGranted="ROLE_ADMINISTRATOR">..</authz:authorize>的条件。

您可以添加另一个逻辑。

于 2012-04-11T06:50:38.140 回答