[opencms-dev] Problem with read deleted files, work online/offline, but not work logout...

Deiverson Silveira deiverson at solutioncms.com
Mon Nov 24 21:46:31 CET 2014


I again...

I see the problem:

in classe CmsObject.java, I have this:

    public List<I_CmsHistoryResource> readDeletedResources(String
resourcename, boolean readTree) throws CmsException {

        CmsResource resource = readResource(resourcename,
CmsResourceFilter.ALL);
        return m_securityManager.readDeletedResources(m_context, resource,
readTree);
    }

This is a problem >>> return
m_securityManager.readDeletedResources(m_context, resource, readTree);

How can set permission in my object?


2014-11-24 16:59 GMT-02:00 Deiverson Silveira <deiverson at solutioncms.com>:

> ahhhh, it is test:
>
> cmso.getRequestContext().setSiteRoot(OpenCms.getSiteManager().getDefaultSite().getSiteRoot());
> cmso.getRequestContext().setCurrentProject(cmso.readProject("Offline"));
>
> But dont work, for work online/offline, remove this.
>
> 2014-11-24 16:58 GMT-02:00 Deiverson Silveira <deiverson at solutioncms.com>:
>
>> Hi List,
>>
>> 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?
>>
>> My Code (but work logged online and offline, but I need work logout :~( :
>> <%@page import="org.opencms.file.CmsProject"%>
>> <%@page import="org.opencms.util.CmsUUID"%>
>> <%@page import="java.io.File"%>
>> <%@page import="java.util.Collections"%>
>> <%@page
>> import="org.apache.commons.io.comparator.LastModifiedFileComparator"%>
>> <%@page import="java.util.Date"%>
>> <%@page import="org.opencms.jsp.CmsJspActionElement"%>
>> <%@page import="java.text.SimpleDateFormat"%>
>> <%@page import="org.opencms.file.CmsObject"%>
>> <%@page import="org.opencms.file.CmsResource"%>
>> <%@page import="org.opencms.workplace.list.CmsListItem"%>
>> <%@page import="org.opencms.file.history.I_CmsHistoryResource"%>
>> <%@page import="org.opencms.main.OpenCms"%>
>> <%@page import="org.opencms.workplace.list.CmsHtmlList"%>
>> <%@page import="java.util.List"%>
>> <%@page import="org.opencms.workplace.commons.CmsDeletedResourcesList"%>
>> <%@page import="java.util.Iterator"%>
>> <%@page import="java.util.Set"%>
>> <%@page import="java.util.Map"%>
>> <%@ page import="org.opencms.workplace.*" %><%
>>  SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");
>>  CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
>> response);
>> CmsObject cmso = cms.getCmsObject();
>>
>>
>> cmso.getRequestContext().setSiteRoot(OpenCms.getSiteManager().getDefaultSite().getSiteRoot());
>> cmso.getRequestContext().setCurrentProject(cmso.readProject("Offline"));
>>  Date dt = null;
>> String dataConvertida = null;
>> String dataPesquisada = "01/01/2014 00:01";
>> I_CmsHistoryResource res = null;
>> Long dataCurrentLong = null;
>> Date dataSearchLong = null;
>> List list = cmso.readDeletedResources("/", true);
>> String arquivo;
>> Iterator iter = list.iterator();
>> out.println("Lista: "+ list.size()+"<br>");
>> try {
>> dataPesquisada = request.getParameter("data").toLowerCase();
>> dataSearchLong = sdf.parse(dataPesquisada);
>> out.println("Data a ser pesquisada maior que: <b>" + dataPesquisada +
>> "</b><br><br>");
>>  while (iter.hasNext()) {
>>     res = (I_CmsHistoryResource)iter.next();
>>     //dataConvertida = String.valueOf(res.getDateLastModified());
>> dataCurrentLong = res.getDateLastModified();
>> arquivo = cmso.getSitePath((CmsResource)res);
>>     dt = new Date(dataCurrentLong);
>> dataConvertida = sdf.format(dt);
>> if(dataCurrentLong > dataSearchLong.getTime()){
>> //cmso.readResource(arquivo).getStructureId().toString()
>>      out.println(" <b>Nome do recurso excluido: </b>" + arquivo +" -
>> <b>UUID:</b> " + res.getResourceId().toString() + "  <b>Data da
>> exclusão:</b> " +  dataConvertida + "<br><br>");
>> }
>> }
>>  } catch (Exception e) {
>> out.println("<br><b>O formato da data deve ser dd/mm/yyyy HH:mm </b>"
>> +e.getMessage());
>> }
>>  %>
>>
>>
>> Help, please experts!
>>
>> Regards,
>>
>> Deiverson
>>
>>
>> --
>> *www.solutioncms.com <http://www.solutioncms.com>The Brazilian Official
>> Provider OpenCms*
>>
>
>
>
> --
> *www.solutioncms.com <http://www.solutioncms.com>The Brazilian Official
> Provider OpenCms*
>



-- 
*www.solutioncms.com <http://www.solutioncms.com>The Brazilian Official
Provider OpenCms*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20141124/26473dc2/attachment.htm>


More information about the opencms-dev mailing list