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
13 Answers:
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.
Sherman
JasperSoft
Post edited by: swood, at: 2007/11/25 19:49
reffering to that code snippet from DefaultJasperViewer.jsp, dont you?
Code: |
<c:if test="${!emptyReport}"><br /> <input type="hidden" name="output"/><br /> <c:forEach items="${configuredExporters}" var="configuredExporter"><br /> ...output td element<br /> </c:forEach><br /> </c:if><br /> </td></tr></tbody></table><br /> <br /> How can i find out about the configuredExporter values? I think i need to check every configuredExporter against a seperate ROLE like:<br /> <br /> <table align="center" border="0" cellpadding="3" cellspacing="1" width="90%"><tbody><tr><td><b>Code:</b></td></tr><tr><td><pre><c:if test="${!emptyReport}"><br /> <input type="hidden" name="output"/><br /> <c:forEach items="${configuredExporters}" var="configuredExporter"><br /> <br /> <c:if test="${configuredExporters=="Excel"}"><br /> <authz:authorize ifNotGranted="ROLE_EXPORT_EXCEL"><br /> ...output td element<br /> </authz:authorize><br /> </c:if><br /> <br /> </c:forEach><br /> </c:if><br /> </td></tr></tbody></table><br /> <br /> or is there an easier way? <br /> <br /> thanks! |
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
i am doing
Code: |
<authz:authorize ifAnyGranted="${configuredExporter.key}"></td></tr></tbody></table><br /> <br /> 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. <br /> Any tips on this? <br /> <br /> 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... :(<br /> <br /> thanks & regards |
i am doing
Code: |
<authz:authorize ifAnyGranted="${configuredExporter.key}"></td></tr></tbody></table><br /> <br /> 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. <br /> Any tips on this? <br /> <br /> 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... :(<br /> <br /> thanks & regards |
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)"? |
Use
Code: |
<authz:authorize ifAnyGranted="ROLE_EXPORT_${configuredExporter.key}"></td></tr></tbody></table><br /> <br /> HTH,<br /> Lucian |
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
danysabo
Wrote:
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 |
You might need to add a taglib directive in the JSP.
Regards,
Lucian
Code: |
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="authz"%></td></tr></tbody></table> |
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....
Greetz
Kerstin