Users from the same group edit group content
cylan97 - July 5, 2007 - 21:05
| Project: | Organic groups |
| Version: | 5.x-7.2 |
| Component: | og.module |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Hi,
In our company intranet, I have assigned users from the same department to the same organic group. I'd like to set up so that a user can edit nodes created by another from the same group. Can OG do that? By assigning "edit groups content" under "Access Control", but that means this user can edit ALL nodes in different groups.
Thanks

#1
not currently possible
#2
what is needed here is a small node access module that gives an upgrade grant for the node to all group subscribers. do not use the 'edit foo' permission for this.
killes was working on this not long ago. bug him about committing it.
#3
I'd like to see this feature too, in order to implement group wikis. Would your method take account of giving subsequent group subscribers access to the nodes, Moshe?
#4
my proposed method will work no matter what subscriber changes happen.
#5
Any updates on this ?
#6
I would have assumed that the access control that the og module puts on node views would also be applied to node edits. Is this not the case?
#7
So is there any way to do so?
#8
not currently possible. it is an interesting feature request. althout it has the usual problem of preference bloat. some people would want all their groups to work in this wiki manner. others want only certain content types, others want it on a group by group basis. ugh.
if someone wants to play around, i think they can get this by editing the grants function to return a grant in the 'update' case for regular subscribers. it is a tricial change to apply it to all groups. it is just a code change, no db change needed.
#9
I just tried it out and it works. anyway, this needs some UI but anyone can get this now by adding the following to og_node_grants() or in your own custom module.
if ($op == 'update') {
$grants['og_subscriber'][] = $key;
}
this is useful enough that i will add it to og one day.
#10
i'd love a patch for this (see my previous post). i think this should be a group specific pref for now, like 'list in directory'.
#11
the one problem i see is when a post is in multiple groups. the easiest implementation would give a post wiki like behavior if *any* of its groups were configured as wiki. not sure that is what people expect, but cross posted nodes are always a difficult case (breadcrumbs, theme, etc.).
#12
to elaborate on that last point, a user could inadvertently make his post a wiki just by adding a group in the audience checkboxes.
#13
Hello, I tried your code:
function og_node_grants($account, $op) {
if ($op == 'update') {
$grants['og_subscriber'][] = $key;
}
if (variable_get('og_enabled', FALSE)) {
if ($op == 'view') {
$grants['og_public'][] = 0; // everyone can see a public node
}
// get subscriptions
if ($subscriptions = og_get_subscriptions($account->uid)) {
foreach ($subscriptions as $key => $val) {
if ($op == 'view') {
$grants['og_subscriber'][] = $key;
}
if (($op == 'update' || $op == 'delete') && $val['is_admin']) {
$grants['og_subscriber'][] = $key;
}
}
}
return $grants ? $grants : array();
}
}
But I don't see any differences?
#14
Actually, code produces error:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND realm = 'og_subscriber') OR (gid = 1001537 AND realm = 'og_subscriber')) AND' at line 1 query: SELECT COUNT(*) FROM totalwar_node_access WHERE (nid = 0 OR nid = 3) AND ((gid = 0 AND realm = 'all') OR (gid = AND realm = 'og_subscriber') OR (gid = 1001537 AND realm = 'og_subscriber')) AND grant_update >= 1 in /home2/mydainet/public_html/includes/database.mysql.inc on line 172.
Not sure where I should be entering it. Thanks!
#15
I too would be interested in having this feature added and would be willing to contribute to the project.
#16
Miraploy, I put the three lines just before the return statement in the og_node_grants() function and it seems to allow group members to view and edit the group content without SQL error. It does however produce an error when a non-member views the group page or group content.
2 errors when trying to display the group page
1 error when trying to display group content
The access seems to be correctly controlled.
#17
I just committed a big change for this issue. Now, site admins can designate whether each content type should be a 'wiki' or not. If wiki, and group member may edit the post. I have not yet implemented anything preference for groups to designate selves as 'wiki' for all content types. Thats a natural extension, but another day.
#18
How do you correct these errors? I'm getting them when
-Users join or leave a group
-When a moderator approves a new group member
#19
I'm slightly behind on the og updates and only just noticed this commit. This is an excellent and much needed development - and such a simple solution. Thank you! This removes the need for og_user_roles for all but the most complex requirements.
I would make one small request - the option to make a group a "read only" wiki/announcements. In other words, members of a group can not edit nodes within the group, but admins to the group can. This would be useful if you have an announcements based group (say of developers) with users as group members.
I can see how the code could be easily patched to achieve this for all groups, but it would be good to code this in as an option, perhaps on a per (group) node type basis rather than for each individual node.
#20
Is the above mentioned commit part of OG 7.3, and if so, does it produce errors there too? (if so, change the version here)
#21
See http://drupal.org/node/290766
--project followup subject--
Automatically closed -- issue fixed for two weeks with no activity.
#22
Automatically closed -- issue fixed for two weeks with no activity.