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
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

moshe weitzman - July 5, 2007 - 23:34
Category:support request» feature request

not currently possible

#2

moshe weitzman - August 4, 2007 - 15:43

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

tonderai - August 8, 2007 - 12:13

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

moshe weitzman - August 8, 2007 - 16:00

my proposed method will work no matter what subscriber changes happen.

#5

guix - November 13, 2007 - 18:51

Any updates on this ?

#6

gustav - November 25, 2007 - 12:24

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

Jkello - December 1, 2007 - 15:52

So is there any way to do so?

#8

moshe weitzman - December 1, 2007 - 16:35

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

moshe weitzman - December 1, 2007 - 16:50

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

moshe weitzman - January 1, 2008 - 05:22
Version:5.x-1.0» 5.x-5.0-rc1
Priority:normal» critical

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

moshe weitzman - January 1, 2008 - 05:25

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

moshe weitzman - January 25, 2008 - 15:50

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

Flying Drupalist - February 12, 2008 - 15:08

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

Flying Drupalist - February 12, 2008 - 22:46

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

lokisapocalypse - February 13, 2008 - 18:49

I too would be interested in having this feature added and would be willing to contribute to the project.

#16

tehfox - February 13, 2008 - 22:24

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

  • 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')) AND grant_update >= 1' at line 1 query: SELECT COUNT(*) FROM node_access WHERE (nid = 0 OR nid = 1) AND ((gid = 0 AND realm = 'all') OR (gid = AND realm = 'og_subscriber')) AND grant_update >= 1 in /var/www/drupal/includes/database.mysql.inc on line 172.
  • 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')) AND grant_update >= 1' at line 1 query: SELECT COUNT(*) FROM node_access WHERE (nid = 0 OR nid = 1) AND ((gid = 0 AND realm = 'all') OR (gid = AND realm = 'og_subscriber')) AND grant_update >= 1 in /var/www/drupal/includes/database.mysql.inc on line 172.

1 error when trying to display group content

  • 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')) AND grant_update >= 1' at line 1 query: SELECT COUNT(*) FROM node_access WHERE (nid = 0 OR nid = 2) AND ((gid = 0 AND realm = 'all') OR (gid = AND realm = 'og_subscriber')) AND grant_update >= 1 in /var/www/drupal/includes/database.mysql.inc on line 172.

The access seems to be correctly controlled.

#17

moshe weitzman - April 20, 2008 - 22:34

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

Mike Sances - June 2, 2008 - 16:17
Version:5.x-5.0-rc1» 5.x-7.2
Category:feature request» bug report

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

scedwar - June 2, 2008 - 16:57

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

DanielTheViking - July 25, 2008 - 19:07

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

scedwar - September 26, 2008 - 21:33
Status:active» fixed

See http://drupal.org/node/290766

--project followup subject--

Anonymous (not verified) - October 10, 2008 - 21:35

Automatically closed -- issue fixed for two weeks with no activity.

#22

Anonymous (not verified) - October 10, 2008 - 21:41
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.