Users can add content to groups where they don't have "create content" permission.

Setup

  • Create user with "create article content" permission in group A and only "update article content" permission in another group B.
  • As this user, create an article in group A.
  • Edit this article and change group selection to group B.

(I'm unable to test form submission at this moment due to another bug)

Fix

In OgSelectionHandler, only include a group in which the user has "update" permission if the node is already in that group.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

+++ b/plugins/entityreference/selection/OgSelectionHandler.class.phpundefined
@@ -116,9 +116,15 @@ class OgSelectionHandler extends EntityReference_SelectionHandler_Generic {
+            $node_groups = isset($node_groups) ? $node_groups : og_get_entity_groups('node', $node->nid);

Why isset($node_groups) ? -- it's not declared before.

Also, can you add a test for it under OgNodeAccess

ezheidtmann’s picture

Yea, I'll try to write a test.

The isset($node_groups) saves repeated calls to og_get_entity_groups() within that loop.

ezheidtmann’s picture

FileSize
2.83 KB

Here's a test that, if it works right, should pass in current code but fail with the fix applied. Not sure at the moment how to invert the logic ...

Status: Needs review » Needs work

The last submitted patch, og-test.2012-10-22.patch, failed testing.

ezheidtmann’s picture

Status: Needs work » Needs review

#3: og-test.2012-10-22.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, og-test.2012-10-22.patch, failed testing.

ezheidtmann’s picture

Status: Needs work » Needs review
FileSize
4.36 KB
2.9 KB

First patch has test only; should fail. Second patch should pass.

amitaibu’s picture

FileSize
6.42 KB

Thanks. I've changed the test to something more simple, as we don't need to create new roles; and it's always better to test the select list itself using XPath.

Status: Needs review » Needs work

The last submitted patch, 1816752-og-update-8.patch, failed testing.

amitaibu’s picture

Status: Needs work » Needs review
FileSize
7.23 KB
amitaibu’s picture

Status: Needs review » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

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