Exposing the same permissions to organic groups is critical for our project. Patch forthcoming.

Comments

cweagans’s picture

Status: Active » Needs review
StatusFileSize
new4.18 KB

Bam.

cweagans’s picture

StatusFileSize
new4.22 KB

Fix a notice in the case that og_context is enabled, but user is not currently in a group context.

grndlvl’s picture

StatusFileSize
new6.33 KB
+++ b/view_unpublished.module
@@ -26,51 +26,67 @@ function view_unpublished_permission() {
+    // Check to see if we're going to check for OG permissions as well.
+    $check_og = FALSE;
+    if (module_exists('og_context')) {
+      $og = og_context();
+      if (!empty($og)) {
+        $check_og = TRUE;
+        $gid = $og->gid;
+      }
+    }

This causes an infinite loop. See #1781218: Calling og_context() in a menu access callback crashes system

Patch changes to

    $check_og = FALSE;
    if (module_exists('og_context')) {
      // When checking content with an access hook we have to use this method
      // to get the group context. Otherwise, we will enter an infinite loop
      // because og_context() does a menu_get_item() which in turns calls the
      // access callbacks. http://drupal.org/node/1781218
      $menu_item = array('path' => $_GET['q']);
      if ($og = og_context_determine_context($menu_item)) {
        $check_og = TRUE;
        $gid = $og->gid;
      }

grndlvl’s picture

StatusFileSize
new4.56 KB

Ignore previous patch contains color ugliness. Here is a clean one.

socialnicheguru’s picture

does this work with og 7.1 or 7.2?

arosboro’s picture

I just applied it and tested with og-7.x-2.x unpublished nodes are visible to users with new og permissions.

arosboro’s picture

I spoke too soon. This patch uses og 7.x-1.x version of og_context_determine_context which causes an infinite loop when menu_get_item is called in 7.x-2.x.

arosboro’s picture

Using spaces instead of og context gets rid of the infinite loop here.

entendu’s picture

Issue summary: View changes
Status: Needs review » Closed (works as designed)

No activity in a long time.

jojonaloha’s picture

Status: Closed (works as designed) » Needs review
StatusFileSize
new3.98 KB

Attached patch adds support for OG 7.x-2.x (tested with OG 7.x-2.7).

I took a different approach then the previous patches, because hook_node_access() doesn't get called for content lists (for example in Views). Since this module already uses the hook_node_grants() and hook_node_access_records() hooks, which do work with content lists, I expanded those to add additional grants if the OG module is enabled.

Also, I haven't added an update script to rebuild node access yet, so you will need to do that after applying the patch.

WorldFallz’s picture

Patch applies cleaning and works as advertised. What do we need to push this forward?

rimu’s picture

#10 works for me too. Thanks jojonaloha!

henrijs.seso’s picture

Status: Needs review » Reviewed & tested by the community

Then...

drupalfan2’s picture

Is this patch still necessary with latest version for Drupal 7?

WorldFallz’s picture

If it's not been committed and the issue closed, then yes.

dalin’s picture

Status: Reviewed & tested by the community » Needs work

Patch applies cleaning and works as advertised. What do we need to push this forward?

I think just a copy of view_unpublished_update_7100() so that the warning pops up about node access needing rebuilt.

dalin’s picture

Actually, here's a re-roll. I was seeing SQL errors with duplicate entries when rebuilding permissions. Just needed some keys in our $grants array. Whether this is my data that is faulty, or an actual bug, I don't know.