<div dir="ltr">Hi List,<div><br></div><div>I'm building a code that need to return the list of deleted files and the uuid from a past date by parameter , however my code works only when I am logged in, if I force the login on the object with admin, works , however it would inject a security breach , this code works online logged in / offline , the problem is when this offline , the file list is reset , someone what should I do to set the permissions of my object so that even offline return my list of deleted resources?</div><div><br></div><div>My Code (but work logged online and offline, but I need work logout :~( :</div><div><div><%@page import="org.opencms.file.CmsProject"%></div><div><%@page import="org.opencms.util.CmsUUID"%></div><div><%@page import="java.io.File"%></div><div><%@page import="java.util.Collections"%></div><div><%@page import="org.apache.commons.io.comparator.LastModifiedFileComparator"%></div><div><%@page import="java.util.Date"%></div><div><%@page import="org.opencms.jsp.CmsJspActionElement"%></div><div><%@page import="java.text.SimpleDateFormat"%></div><div><%@page import="org.opencms.file.CmsObject"%></div><div><%@page import="org.opencms.file.CmsResource"%></div><div><%@page import="org.opencms.workplace.list.CmsListItem"%></div><div><%@page import="org.opencms.file.history.I_CmsHistoryResource"%></div><div><%@page import="org.opencms.main.OpenCms"%></div><div><%@page import="org.opencms.workplace.list.CmsHtmlList"%></div><div><%@page import="java.util.List"%></div><div><%@page import="org.opencms.workplace.commons.CmsDeletedResourcesList"%></div><div><%@page import="java.util.Iterator"%></div><div><%@page import="java.util.Set"%></div><div><%@page import="java.util.Map"%></div><div><%@ page import="org.opencms.workplace.*" %><%<span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); </div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);</div><div><span class="" style="white-space:pre"> </span>CmsObject cmso = cms.getCmsObject();</div><div><br></div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>cmso.getRequestContext().setSiteRoot(OpenCms.getSiteManager().getDefaultSite().getSiteRoot());</div><div><span class="" style="white-space:pre"> </span>cmso.getRequestContext().setCurrentProject(cmso.readProject("Offline"));</div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>Date dt = null;</div><div><span class="" style="white-space:pre"> </span>String dataConvertida = null;</div><div><span class="" style="white-space:pre"> </span>String dataPesquisada = "01/01/2014 00:01";</div><div><span class="" style="white-space:pre"> </span>I_CmsHistoryResource res = null;</div><div><span class="" style="white-space:pre"> </span>Long dataCurrentLong = null;</div><div><span class="" style="white-space:pre"> </span>Date dataSearchLong = null;</div><div><span class="" style="white-space:pre"> </span>List list = cmso.readDeletedResources("/", true); </div><div><span class="" style="white-space:pre"> </span>String arquivo;</div><div><span class="" style="white-space:pre"> </span>Iterator iter = list.iterator();</div><div><span class="" style="white-space:pre"> </span>out.println("Lista: "+ list.size()+"<br>");</div><div><span class="" style="white-space:pre"> </span>try {</div><div><span class="" style="white-space:pre"> </span>dataPesquisada = request.getParameter("data").toLowerCase();</div><div><span class="" style="white-space:pre"> </span>dataSearchLong = sdf.parse(dataPesquisada);</div><div><span class="" style="white-space:pre"> </span>out.println("Data a ser pesquisada maior que: <b>" + dataPesquisada + "</b><br><br>");</div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>while (iter.hasNext()) {</div><div><span class="" style="white-space:pre"> </span> res = (I_CmsHistoryResource)iter.next();</div><div><span class="" style="white-space:pre"> </span> //dataConvertida = String.valueOf(res.getDateLastModified());</div><div><span class="" style="white-space:pre"> </span>dataCurrentLong = res.getDateLastModified();</div><div><span class="" style="white-space:pre"> </span>arquivo = cmso.getSitePath((CmsResource)res);</div><div><span class="" style="white-space:pre"> </span> dt = new Date(dataCurrentLong);</div><div><span class="" style="white-space:pre"> </span>dataConvertida = sdf.format(dt);</div><div><span class="" style="white-space:pre"> </span>if(dataCurrentLong > dataSearchLong.getTime()){</div><div><span class="" style="white-space:pre"> </span>//cmso.readResource(arquivo).getStructureId().toString()</div><div><span class="" style="white-space:pre"> </span> <span class="" style="white-space:pre"> </span>out.println(" <b>Nome do recurso excluido: </b>" + arquivo +" - <b>UUID:</b> " + res.getResourceId().toString() + " <b>Data da exclusão:</b> " + dataConvertida + "<br><br>");</div><div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>} catch (Exception e) {</div><div><span class="" style="white-space:pre"> </span>out.println("<br><b>O formato da data deve ser dd/mm/yyyy HH:mm </b>" +e.getMessage());</div><div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>%></div></div><div><br></div><div><br></div><div>Help, please experts!</div><div><br></div><div>Regards,</div><div><br></div><div>Deiverson</div><div><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><i><div><span style="font-style:normal"><i><div><span style="font-style:normal"><i><div style="display:inline!important"><span style="font-style:normal"><i><a href="http://www.solutioncms.com" target="_blank">www.solutioncms.com</a></i></span></div></i></span></div><div><span style="font-style:normal"><i><span style="font-style:normal"><i><div><span style="font-style:normal"><i><div style="display:inline!important"><span style="font-style:normal"><i><span style="font-style:normal"><i><div style="display:inline!important"><i>The Brazilian </i><span style="font-style:normal"><i><div style="display:inline!important"><span style="font-style:normal"><i><span style="font-style:normal"><i><div style="display:inline!important"><i>Official Provider OpenCms</i></div></i></span></i></span></div></i></span></div></i></span></i></span></div></i></span></div></i></span></i></span></div></i></span></div></i></div>
</div></div>