It seems like the function og_node_create_links() should be using og_user_access() to check permissions instead of just node_access(). The problem I'm seeing is that calling og_node_create_links() to display links in a block and then displaying the block on a group page. Ideally the links will only contain the content types that the user has permission to create in the context of the group currently being viewed.

I've attached a patch that fixes this for my use case however I'm not entirely sure what other ramifications it might have.

Related: #1600910: Create Content Block showing to none group members

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

Status: Needs review » Needs work
+++ b/og.moduleundefined
@@ -3054,7 +3054,9 @@ function og_node_create_links($group_type, $gid, $field_name, $destination = NUL
+    $perm = t('Create %type_name content', array('%type_name' => $info->name));

The perm name should be og_user_access($group_type, $gid, "create $node_type content")

+ How about a small test ? :)

Jax’s picture

Updated patch with correct permission. Test still missing.

Jax’s picture

FileSize
566 bytes

Ooops. This is the correct patch.

eojthebrave’s picture

amitaibu’s picture

Status: Needs work » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

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