DocJones Posted November 22, 2007 Share Posted November 22, 2007 Heyas, is there a way to control the export (as PDF, CSV, XLS) on a Role/User base in JasperServer?Basically, i want to give some Users the possibility to export the data in a raw format (XLS or CSV), while others are only allowed to see the PDF/Image. Additional: The rendered image of a report differs from the "preview" from iReport. It seems, that some graphical elements are not being rendered properly (sometimes a text is only half shown, sometimes a background elemental box is rendered in white only).Is there something to take care of? thanks Link to comment Share on other sites More sharing options...
swood Posted November 26, 2007 Share Posted November 26, 2007 For the first question about selectively showing the export options, you will have to change the DefaultJasperView.jsp to check for roles with the Acegi authz:authorize tag and display or not display the export options. There is an example of using authz:authorize in WEB-INF/decorators/main.jsp On the difference between iReport and JasperServer: if you have report elements that overlap in some way, they will not be displayed in HTML, due to the limitations of HTML, but are displayed in PDF, RTF etc. This is usually the problem. ShermanJasperSoftPost edited by: swood, at: 2007/11/25 19:49 Link to comment Share on other sites More sharing options...
DocJones Posted December 4, 2007 Author Share Posted December 4, 2007 Heyas, reffering to that code snippet from DefaultJasperViewer.jsp, dont you? Code:<c:if test="${!emptyReport}"> <input type="hidden" name="output"/> <c:forEach items="${configuredExporters}" var="configuredExporter">...output td element</c:forEach></c:if> How can i find out about the configuredExporter values? I think i need to check every configuredExporter against a seperate ROLE like: Code:[code]<c:if test="${!emptyReport}"> <input type="hidden" name="output"/> <c:forEach items="${configuredExporters}" var="configuredExporter"><c:if test="${configuredExporters=="Excel"}"><authz:authorize ifNotGranted="ROLE_EXPORT_EXCEL">...output td element</authz:authorize></c:if></c:forEach></c:if> or is there an easier way? thanks! Link to comment Share on other sites More sharing options...
lucianc Posted December 5, 2007 Share Posted December 5, 2007 You can find the list of configured exporters in WEB-INF/flows/viewReportBeans.xml (see the exporterConfigMap bean). If you derive the role names from the exporter keys, you would not need to write repetitive code in DefaultJasperViewer.jsp. Note that hiding the export icons does not actually prevent an ill intentioned (and technical) user to fire a request that produces output that he should not be able to produce. A complete solution would require the authorization to be checked on the server; such a solution would be of course more elaborate. Regards,Lucian Link to comment Share on other sites More sharing options...
DocJones Posted December 5, 2007 Author Share Posted December 5, 2007 Heyas, i am doingCode:<authz:authorize ifAnyGranted="${configuredExporter.key}"> key names are "pdf", "xls", "rtf" and "csv". However, if i define a role with that name and assign a user to it, it wont work. Any tips on this? 2nd question: is it possible to do a concatenation to make the role names begin with "ROLE_EXPORT_(pdf|xls|rtf|csv)"? i am not (yet) skilled enough to do it on my own... :( thanks & regards Link to comment Share on other sites More sharing options...
DocJones Posted December 5, 2007 Author Share Posted December 5, 2007 Heyas, i am doingCode:<authz:authorize ifAnyGranted="${configuredExporter.key}"> key names are "pdf", "xls", "rtf" and "csv". However, if i define a role with that name and assign a user to it, it wont work. Any tips on this? 2nd question: is it possible to do a concatenation to make the role names begin with "ROLE_EXPORT_(pdf|xls|rtf|csv)"? i am not (yet) skilled enough to do it on my own... :( thanks & regards Link to comment Share on other sites More sharing options...
lucianc Posted December 5, 2007 Share Posted December 5, 2007 DocJones wrote:However, if i define a role with that name and assign a user to it, it wont work. Any tips on this? Did you try to login/logout? 2nd question: is it possible to do a concatenation to make the role names begin with "ROLE_EXPORT_(pdf|xls|rtf|csv)"? UseCode:<authz:authorize ifAnyGranted="ROLE_EXPORT_${configuredExporter.key}"> HTH,Lucian Link to comment Share on other sites More sharing options...
DocJones Posted December 5, 2007 Author Share Posted December 5, 2007 :silly: Yay! Logging out/in worked. And the concatenation, too.. *two thumbs up* Link to comment Share on other sites More sharing options...
danysabo Posted December 30, 2009 Share Posted December 30, 2009 I inserted same piece of code <authz:authorize ifAnyGranted="ROLE_EXPORT_${configuredExporter.key}">...output td element</authz:authorize> and I tried to logout/login, but I always get exporter icons displayed.I have several users, only one of them have role ROLE_EXPORT_pdf and ROLE_EXPORT_xls, but everyone can see that icons. I tried to restart tomcat server also, but nothing helped.I am using JasperServer 3.7.0 Release Candidate.Can someone help?Post Edited by danysabo at 12/30/2009 19:04 Link to comment Share on other sites More sharing options...
swood Posted January 7, 2010 Share Posted January 7, 2010 What JSP did you change? ShermanJaspersoft Link to comment Share on other sites More sharing options...
danysabo Posted January 8, 2010 Share Posted January 8, 2010 I changed DefaultJasperViewer.jsp file (inside jsp folder), same file as mentioned above. Link to comment Share on other sites More sharing options...
lucianc Posted January 12, 2010 Share Posted January 12, 2010 danysaboWrote: I inserted same piece of code and I tried to logout/login, but I always get exporter icons displayed. I have several users, only one of them have role ROLE_EXPORT_pdf and ROLE_EXPORT_xls, but everyone can see that icons. I tried to restart tomcat server also, but nothing helped. I am using JasperServer 3.7.0 Release Candidate. Can someone help? Post Edited by danysabo at 12/30/2009 19:04 You might need to add a taglib directive in the JSP.Regards,LucianCode:<%@ taglib uri="http://www.springframework.org/security/tags" prefix="authz"%> Link to comment Share on other sites More sharing options...
danysabo Posted January 25, 2010 Share Posted January 25, 2010 Thanks Lucian, it helped! Link to comment Share on other sites More sharing options...
kthormann Posted November 23, 2010 Share Posted November 23, 2010 same problem...my code: <authz:authorize ifNotGranted="ROLE_TEST"> <td width="1" valign="top"><a href="javascript:exportReport('${configuredExporter.key}'<c:if test="${not empty exportFilename}">, '<c:url value="flow.html/flowFile/${exportFilename}"/>'</c:if>)" title="<spring:message code='${configuredExporter.value.descriptionKey}'/>"><img src="${pageContext.request.contextPath}${configuredExporter.value.iconSrc}" border="0" alt="<spring:message code='${configuredExporter.value.descriptionKey}'/>"/></a></td> <td width="1"> </td> </authz:authorize>even if the user dont have the role ROLE_TEST he see's the exporters.... GreetzKerstin Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now