ok I found the bug and made a fix:
its not in MG but in the user_documents_permissions.class.php class in all 096x versions
first this line (33):
if($GLOBALS['use_udperms']==0 || $GLOBALS['use_udperms']=="" || !isset($GLOBALS['use_udperms'])) {
return true; // permissions aren't in use
}
this will always return true because $GLOBALS[’use_udperms’] does not exist it must be $modx->config[’use_udperms’], like this:
if($modx->config['use_udperms']==0 || $modx->config['use_udperms']=="" || !isset($modx->config['use_udperms'])) {
return true; // permissions aren't in use
}
these line must be changed also for the last part to work right:
from:
if($_SESSION['mgrDocgroups']) {
$docgrp = implode(",",$_SESSION['mgrDocgroups']);
}
to:
if($_SESSION['mgrDocgroups']) {
$docgrp = implode(" || dg.document_group = ",$_SESSION['mgrDocgroups']);
}
this comes in to play when more then one docgroup is asigned to a user
the last problem is the last db query that somhow always ended up being 1 also always returned true:
$tblsc = $dbase.".`".$table_prefix."site_content`";
$tbldg = $dbase.".`".$table_prefix."document_groups`";
$tbldgn = $dbase.".`".$table_prefix."documentgroup_names`";
$sql = "SELECT DISTINCT sc.id
FROM $tblsc sc
LEFT JOIN $tbldg dg on dg.document = sc.id
LEFT JOIN $tbldgn dgn ON dgn.id = dg.document_group
WHERE sc.id = $document
AND (1='' OR NOT(dgn.private_memgroup<=>1)".(!$docgrp ? "":" OR dg.document_group IN ($docgrp)").");";
// ^ MySQL 4.1 will not return the correct result if this statement is removed! ???
$rs = mysql_query($sql);
$limit = mysql_num_rows($rs);
this should be in my opinion this:
$tblsc = $dbase.".`".$table_prefix."site_content`";
$tbldg = $dbase.".`".$table_prefix."document_groups`";
$tbldgn = $dbase.".`".$table_prefix."documentgroup_names`";
$sql = "SELECT DISTINCT sc.id
FROM $tblsc sc
LEFT JOIN $tbldg dg on dg.document = sc.id
LEFT JOIN $tbldgn dgn ON dgn.id = dg.document_group
WHERE sc.id = $document
AND (dg.document_group = $docgrp)";
$rs = mysql_query($sql);
$limit = mysql_num_rows($rs);
made a bug myself but that is fixed now the bug came when a user was assigned to more then one docgroup
This bug also made it possible for manager users that where not in the right docgroup to delete, move, copying, (un)publish (all except editing) any document.
so also by applying this fix those things are not possible anymore (thats a good thing)
greets Dimmy