FYI,
We installed an 0963 snapshot (rev #4293) and ran into a pretty big issue for our content development team.
At this time, manager users assigned to a "Role" (content editors) are unable to Edit MODx documents!!
Quote from: "MODx
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/user/public_html/manager/processors/user_documents_permissions.class.php on line 108
The above error is thrown, in addition to:
Access permissions
You do not have the correct permissions for this document.
However, this occurs on public documents with no doc permissions, too...
NOTE: This does NOT occur for Admin users...
The last change to this file was REV 4225 on 10/2/08, references
http://modxcms.com/forums/index.php/topic,29278.0.html (thx Jason)
Here’s the unified diff:
--- C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\user_documents_permissions.class.php-rev4224.svn000.tmp.php Mon Oct 20 12:15:55 2008
+++ W:\_svn\modx096svn\0.9.6\manager\processors\user_documents_permissions.class.php Mon Oct 13 15:59:11 2008
@@ -28,7 +28,7 @@
$permissionsok = false; // set permissions to false
- if($GLOBALS['use_udperms']==0 || $GLOBALS['use_udperms']=="" || !isset($GLOBALS['use_udperms'])) {
+ if($modx->config['use_udperms']==0 || $modx->config['use_udperms']=="" || !isset($modx->config['use_udperms'])) {
return true; // permissions aren't in use
}
@@ -83,7 +83,7 @@
// get document groups for current user
if($_SESSION['mgrDocgroups']) {
- $docgrp = implode(",",$_SESSION['mgrDocgroups']);
+ $docgrp = implode(" || dg.document_group = ",$_SESSION['mgrDocgroups']);
}
/* Note:
@@ -97,13 +97,13 @@
$tblsc = $dbase.".`".$table_prefix."site_content`";
$tbldg = $dbase.".`".$table_prefix."document_groups`";
$tbldgn = $dbase.".`".$table_prefix."documentgroup_names`";
- $sql = "SELECT DISTINCT sc.id
+ $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! ???
+ AND (dg.document_group = $docgrp || sc.privatemgr = 0)";
+
$rs = mysql_query($sql);
$limit = mysql_num_rows($rs);
if($limit==1) $permissionsok = true;
Reverting back to REV 4224 of this file does appear to correct this issue.
The cause is due to invalid SQL syntax:
SELECT DISTINCT sc.id FROM `modx_bplansco`.`modx_site_content` sc LEFT JOIN `modx_bplansco`.`modx_document_groups` dg on dg.document = sc.id LEFT JOIN `modx_bplansco`.`modx_documentgroup_names` dgn ON dgn.id = dg.document_group WHERE sc.id = 684 AND (dg.document_group = || sc.privatemgr = 0)
NOTE: dg.document_group = ...