Delete emails from gui not work

Issue #1113 closed
HgoAlv created an issue

Hi,

I have the last version from piler, and when i want to delete selected emails from gui not work.

I have ENABLE_DELETE=1, I’m login with auditor user without restrictions, and I have enable folders.

What is the problem?

Thanks

Comments (19)

  1. Janos SUTO repo owner

    What happens when the auditor marks a message for removal? Also note that the marked emails won’t disappear right away, the periodic purge process will eliminate them.

  2. HgoAlv reporter

    When I select messages and click remove button, show a message “remove successfully“ but the messages not appear in mysql dB in delete table and not dissappear from search.

  3. HgoAlv reporter

    Hi Janos,

    First, thanks for your replies.

    I have ENABLE_DELETE = 1, but the problem is that not work.

    I debug the code and I think that the problem is in this function from search.php

    function check_your_permission_by_id_list () because return a empty array and for this message not mark for removing.

    Thanks

    Regards

  4. Janos SUTO repo owner

    How is that possible? An auditor has access to any emails. Perhaps you turned on the ENABLE_SAAS flag?

  5. Janos SUTO repo owner

    OK. In case you didn’t turn on the ENABLE_FOLDER_RESTRICTIONS flag either, then check the $id argument of the check_your_permission_by_id_list() function, and verify that it’s a non-empty array.

  6. Janos SUTO repo owner

    My bad, just read the issue description again, and you have the folders feature enabled. So check the result of the following query (around the 803rd line):

    $query = $this->sphx->query("SELECT id, folder FROM " . SPHINX_MAIN_INDEX . " WHERE id IN (" . implode(",", $id) . ")");
    

    \$query->rows should have some results.

  7. Janos SUTO repo owner

    Then check the sphinx config if you have specified the folder column, and then check if you have actually configured any folders.

    I’m not sure if you really need the folder stuff, in that case you may turn it off.

  8. HgoAlv reporter

    Hi Janos,

    Yes I have 3 folders imported in piler, and in gui I see this 3 folders and I can search in them.

    What have I check in sphinx.conf?

  9. HgoAlv reporter

    yes,

    In sphinx.conf in delta index the query have the folder column

    sql_query = SELECT id, from, to, fromdomain, todomain, subject, arrived, sent, body, size, direction, folder, attachments, attachment_types FROM sph_index
    WHERE id <= (SELECT max_doc_id FROM sph_counter WHERE counter_id=1)

  10. HgoAlv reporter

    Hi Janos,

    I’m check the history and I detect an error.

    Janos SUTO

    repo owner

    My bad, just read the issue description again, and you have the folders feature enabled. So check the result of the following query (around the 803rd line):

    $query = $this->sphx->query("SELECT id, folder FROM " . SPHINX_MAIN_INDEX . " WHERE id IN (" . implode(",", $id) . ")");
    

    This line not affect, because enter first in this if because auditor_user==1 and Restricted_Auditor==0 in my configuration

    if(Registry::get('auditor_user') == 1 && RESTRICTED_AUDITOR == 0) {
    $query = $this->db->query("SELECT id FROM " . TABLE_META . " WHERE id IN ($q2)", $arr);
    }

    And jump to this code

    if($query->num_rows > 0) {
    foreach ($query->rows as $q) {
    if(ENABLE_FOLDER_RESTRICTIONS == 1) {
    if(in_array($q['folder'], $session->get("folders"))) { array_push($result, $q['id']); ##the execution NOT enter here }

    #the execution enter here
    }
    else if(!in_array($q['id'], $result) && !in_array($q['id'], $parr)) {
    array_push($result, $q['id']);
    }
    }
    }

    return $result;

  11. HgoAlv reporter

    I think that the problem is in this line:

    if(in_array($q['folder'], $session->get("folders"))) { array_push($result, $q['id']); ##the execution NOT enter here }

    \$q['folder'] not exits, because this query $query = $this->db->query("SELECT id FROM " . TABLE_META . " WHERE id IN ($q2)", $arr); not return the ‘folder' only return the 'id’.

    I think that if I change the query for this:

    $query = $this->db->query("SELECT " . TABLE_META . ".id, " . TABLE_FOLDER_MESSAGE . ".folder_id AS folder FROM " . TABLE_META . " JOIN " . TABLE_FOLDER_MESSAGE . " ON " . TABLE_META . ".id = " . TABLE_FOLDER_MESSAGE . ".id WHERE " . TABLE_META . ".`id` IN ($q2)", $arr);

    the problem would be solved.

    Thanks

  12. Janos SUTO repo owner

    Try editing the 778th line. It’s

    if(Registry::get('auditor_user') == 1 && RESTRICTED_AUDITOR == 0) {
    

    Fix it by adding ENABLE_FOLDER_RESTRICTIONS == 0, ie.

    if(Registry::get('auditor_user') == 1 && RESTRICTED_AUDITOR == 0 && ENABLE_FOLDER_RESTRICTIONS == 0) {
    

    Now, if you remove a message, then the retained column should change to the current timestamp, so the purge utility could get rid of it.

  13. Log in to comment