- edited description
Delete emails from gui not work
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)
-
reporter -
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.
-
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.
-
repo owner I’ve updated the docs to describe how the removal works.
https://www.mailpiler.org/wiki/current:removing-emails-from-the-archive
-
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
-
repo owner How is that possible? An auditor has access to any emails. Perhaps you turned on the ENABLE_SAAS flag?
-
reporter Hi Janos,
I haven't this flag in my config-site.php.
Thanks
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Libre de virus. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-
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.
-
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.
-
reporter I think that this line is the problem. $query is empty
-
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.
-
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?
-
repo owner The sql query for the delta index.
-
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) -
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 . "
WHEREid
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;
-
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
-
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.
-
reporter Thanks Janos,
With that change it work correctly!!.
-
repo owner - changed status to closed
Then case is closed.
- Log in to comment