Workspace with nodeperm_role
bomarmonk - July 27, 2005 - 08:04
| Project: | Workspace |
| Version: | 4.7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
With workspace and nodeperm role installed, the latest workspace module (CVS July 27) shows several duplicates of every node in the admin's workspace (all content has been created by the admin account, so nothing is assigned through nodeperm). I'm running Drupal 4.6.2.

#1
To clarify this issue: I'm getting redundant listings for nodes when running nodeperm_role with Drupal 4.6.2 and the workspace module. For example, I'll have uploaded a single image, but it will be listed around twenty times in the workspace list. The content list at admin/node lists nodes correctly. Any ideas?
Moving this up to critical, as this issue makes workspace very unuseable.
#2
Okay, I reverted back to the old 4.5 version of workspace and it seems to work fine, but without the support for nodeperm role. No redundant listings of nodes! So this is definitely a problem with nodeperm role and workspace working together.
#3
For the love of Drupal... can anyone suggest a fix for this? Thanks in advance!
#4
Am aware of this. Have not had time to fix it. Adding support to simpleaccess.module in workspace cvs may be the way out.
#5
I switched to simple access, and now I realized you were talking about future compatibility and not something to test now. Oops.
#6
Do you think there will be added support for simple access? I like simpleaccess just as well as nodeperm_role, so either solution would work for me. The bottom line: workspace brings everything together for the users of my site if I can get it to work with either access module. I'm just voicing my support for this added functionality and thanking you for the great module.
#7
Support for simple_access is a good idea. I have not had time to write it. If someone wants to supply a patch, that would be great.
#8
v1.16.2.2 here and duplicating the entries for admin. this couldn't be as simple as a SELECT DISTINCT, could it? (i'm not root on our server, so i can't clear the PHP cache of the module code.)
#9
Any luck with this? Any alternatives? This functionality seems fairly important for users who have permission to edit content that they did not create (therefore it doesn't just show up in their "content" listing-- only their created nodes do this, to my understanding-- so we need workspace!). So I would make the argument that this could be pretty important for certain sites (and if I knew more about PHP or had the available time to learn it, I might do more than talk. I humbly appeal to those with the power of PHP! And of course all of you don't have time either-- I know, I know). Thanks in advance for patches from the sky (aka manna from heaven).
#10
#11
Changing issue to a feature request for 4.7. See new issue.
#12
I am reactivating this, because the author of node_perm role is willing to work with the author of workspace to solve this issue... perhaps this could be related to a wider access problem with how workspace functions?
#13
This is also still an issue with Drupal 4.7..
#14
I ran into the duplicate entry problem while hacking for use with simple_access. See http://drupal.org/node/59924 for the simple_access patch, which also fixed the duplicate entry problem. Using DISTINCT didn't work (though I can't remember exactly why). I did a 'GROUP BY n.nid' then SUM on the grant fields. Here's that part of the patch:
@@ -166,19 +171,21 @@ function workspace_list() {
$node_join = array('LEFT JOIN {node_comment_statistics} s ON n.nid = s.nid');
$node_where = array('n.uid = '. db_escape_string($user->uid));
- if ($nodeperm_role_enabled) {
- $node_select[] = 'na.grant_update';
- $node_select[] = 'na.grant_delete';
- $node_join[] = 'LEFT JOIN node_access na ON n.nid = na.nid';
- $node_where[] = 'OR (na.realm = "nodeperm_role" AND na.grant_view = 1 AND na.gid IN('. db_escape_string(implode(',', array_flip($user->roles))) .'))';
+// if ($nodeperm_role_enabled) {
+ if ($access_enabled) {
+ $node_select[] = 'SUM(na.grant_update) AS grant_update';
+ $node_select[] = 'SUM(na.grant_delete) AS grant_delete';
+ $node_join[] = 'LEFT JOIN {node_access} na ON n.nid = na.nid';
+ $node_where[] = 'OR (na.realm = "'.$access_enabled.'" AND na.gid IN('. db_escape_string(implode(',', array_flip($user->roles))) .'))';
}
- $sql = 'SELECT '. implode(', ', $node_select) .' FROM '. implode(', ', $node_from) .' '. implode(' ', $node_join) .' WHERE '. implode(' ', $node_where);
+ $sql = 'SELECT '. implode(', ', $node_select) .' FROM '. implode(', ', $node_from) .' '. implode(' ', $node_join) .' WHERE '. implode(' ', $node_where) . " GROUP BY n.nid";
$count_sql = 'SELECT COUNT(n.nid) FROM '. implode(', ', $node_from) .' '. implode(' ', $node_join) .' WHERE '. implode(' ', $node_where);
I haven't really had a chance to review this, just needed it to work right away for a deadline. I'll will continue working on this patch as my time allows and will post on the other issue (http://drupal.org/node/59924).
#15
Sorry, forgot to mention that the patch I'm working on is for 4.7, specifically from:
// $Id: workspace.module,v 1.21.2.7 2006/05/07 19:44:00 jvandyk Exp $#16
The patch certainly removes the duplicates and more. Using nodeperm_role, user1 has view and edit permissions for page1, which was authored by user2. I would assume that page1 will be in user1's workspace list. Applying the patch, makes the workspace empty for user1.
#17
above is says drupal 4.6, I'm using 4.7
and from the module file...
// $Id: workspace.module,v 1.21.2.7 2006/05/07 19:44:00 jvandyk Exp $
#18
Closed as this thread pertains to an outdated version. Please open a new issue if problem persists with current release.
tia
Frank