<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:12.7272720336914px">ahhhh, it is test:</span><div style="font-family:arial,sans-serif;font-size:12.7272720336914px"><div style="font-size:12.7272720336914px">cmso.getRequestContext().setSiteRoot(OpenCms.getSiteManager().getDefaultSite().getSiteRoot());<span style="font-size:12.7272720336914px;white-space:pre-wrap">   </span><span style="font-size:12.7272720336914px">cmso.getRequestContext().</span><span style="font-size:12.7272720336914px">setCurrentProject(cmso.</span><span style="font-size:12.7272720336914px">readProject("Offline"));</span></div></div><div style="font-family:arial,sans-serif;font-size:12.7272720336914px"><span style="font-size:12.7272720336914px"><br></span></div><div style="font-family:arial,sans-serif;font-size:12.7272720336914px"><span style="font-size:12.7272720336914px">But dont work, for work online/offline, remove this.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-24 16:58 GMT-02:00 Deiverson Silveira <span dir="ltr"><<a href="mailto:deiverson@solutioncms.com" target="_blank">deiverson@solutioncms.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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 style="white-space:pre-wrap">  </span></div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); </div><div><span style="white-space:pre-wrap">     </span></div><div><span style="white-space:pre-wrap"> </span>CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);</div><div><span style="white-space:pre-wrap">       </span>CmsObject cmso = cms.getCmsObject();</div><div><br></div><div><span style="white-space:pre-wrap">    </span></div><div><span style="white-space:pre-wrap"> </span>cmso.getRequestContext().setSiteRoot(OpenCms.getSiteManager().getDefaultSite().getSiteRoot());</div><div><span style="white-space:pre-wrap">   </span>cmso.getRequestContext().setCurrentProject(cmso.readProject("Offline"));</div><div><span style="white-space:pre-wrap">               </span></div><div><span style="white-space:pre-wrap"> </span>Date dt = null;</div><div><span style="white-space:pre-wrap">  </span>String dataConvertida = null;</div><div><span style="white-space:pre-wrap">    </span>String dataPesquisada = "01/01/2014 00:01";</div><div><span style="white-space:pre-wrap">    </span>I_CmsHistoryResource res = null;</div><div><span style="white-space:pre-wrap"> </span>Long dataCurrentLong = null;</div><div><span style="white-space:pre-wrap">     </span>Date dataSearchLong = null;</div><div><span style="white-space:pre-wrap">      </span>List list = cmso.readDeletedResources("/", true); </div><div><span style="white-space:pre-wrap">    </span>String arquivo;</div><div><span style="white-space:pre-wrap">  </span>Iterator iter = list.iterator();</div><div><span style="white-space:pre-wrap"> </span>out.println("Lista: "+ list.size()+"<br>");</div><div><span style="white-space:pre-wrap">    </span>try {</div><div><span style="white-space:pre-wrap">            </span>dataPesquisada = request.getParameter("data").toLowerCase();</div><div><span style="white-space:pre-wrap">           </span>dataSearchLong = sdf.parse(dataPesquisada);</div><div><span style="white-space:pre-wrap">              </span>out.println("Data a ser pesquisada maior que: <b>" + dataPesquisada + "</b><br><br>");</div><div><span style="white-space:pre-wrap">       </span></div><div><span style="white-space:pre-wrap">         </span>while (iter.hasNext()) {</div><div><span style="white-space:pre-wrap">         </span>    res = (I_CmsHistoryResource)iter.next();</div><div><span style="white-space:pre-wrap">           </span>    //dataConvertida = String.valueOf(res.getDateLastModified());</div><div><span style="white-space:pre-wrap">                      </span>dataCurrentLong = res.getDateLastModified();</div><div><span style="white-space:pre-wrap">                     </span>arquivo = cmso.getSitePath((CmsResource)res);</div><div><span style="white-space:pre-wrap">            </span>    dt = new Date(dataCurrentLong);</div><div><span style="white-space:pre-wrap">                    </span>dataConvertida = sdf.format(dt);</div><div><span style="white-space:pre-wrap">                 </span>if(dataCurrentLong > dataSearchLong.getTime()){</div><div><span style="white-space:pre-wrap">                               </span>//cmso.readResource(arquivo).getStructureId().toString()</div><div><span style="white-space:pre-wrap">         </span>    <span style="white-space:pre-wrap">  </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 style="white-space:pre-wrap">                      </span>}</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap"> </span>} catch (Exception e) {</div><div><span style="white-space:pre-wrap">          </span>out.println("<br><b>O formato da data deve ser dd/mm/yyyy HH:mm </b>" +e.getMessage());</div><div><span style="white-space:pre-wrap">      </span>}</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap"> </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><span class="HOEnZb"><font color="#888888"><div><br clear="all"><div><br></div>-- <br><div><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></font></span></div>
</blockquote></div><br><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>