Search code examples
ploneprivilegesresponsetext

Unsufficient privileges from responseText in Plone4.3


I use PloneBooking3.0.0a2 with Plone4.3.3, but if I want to show periodic bookings I get an unsufficient privileges error. In my opinion there are two functions responsible for that:

function showPeriodicityResult(url, alt_url, target_id, form_id, waiting_text) {
    ajaxobject = getXmlHttpRequest();

    form = document.getElementById(form_id);
    periodicity_type = getPeriodicityType(form);
    periodicity_end_date = form['periodicity_form_periodicity_end_date_0'].value;
    periodicity_variable = form['periodicity2_x'].value;

    query = getPeriodicityQuery(periodicity_type, periodicity_end_date, periodicity_variable);
    url = url + query + "&d=" + (new Date()).getTime();
    alt_url = alt_url + query;

    // Opera does not support ajax
    if (ajaxobject == null) {
        window.location = alt_url;
    } else {
        var node = document.getElementById(target_id);
        node.innerHTML = waiting_text;
        ajaxobject.open('GET', url, true);
        ajaxobject.onreadystatechange = function(){CallBackGenerateAjaxHTML(ajaxobject, target_id);};
        ajaxobject.send(null);
    }
}

and

function CallBackGenerateAjaxHTML(ajaxobject, target_id) {
    if (ajaxobject.readyState == 4) {
        if (ajaxobject.status > 299 || ajaxobject.status < 200) {
            return;
        }
        elem = document.getElementById(target_id);
        elem.innerHTML = ajaxobject.responseText;
    }
}

Especially the innerHTML setting with responseText seems to be a problem. Is there is a quick answer like Plone version diff from 3 to 4 or must I work in-depth?


Solution

  • You mentioned in the comments that the portal.uid_catalog raises the Unauthorized.

    When I recall correctly the uid-catalog requires a higher permission since the last Plone hotfix. But you also can search an Item when given a UID with the normal Catalog.

    here_obj python:portal.portal_catalog(UID=here_uid)[0].getObject();
    

    This way you should be able to get your Object.