2012-04-06 4 views

答えて

2

jasperserver\WEB-INF\decorators\decoratorCommonComponents.jspファイルを変更することができます。

ユーザーでない管理者の役割であればログアウトリンクを非表示にする方法を示し、このJSPファイルの抜粋:

<%-- 
*********************************************************************** 
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>条件を追加しました。

別のロジックを追加することができます。

+1

ログアウトリンクを非表示にしたい場合は、custom_overrides.cssに行を追加するほうが簡単です。このようなもの: '#main_logOut {display:none;}'。あなたの正確なニーズに応じて、いずれかの解決策が機能します。 – mdahlman

+0

しかし、より安全なソリューションが必要な場合は、最初のものを実行してください。 –

関連する問題