[support] OG - Allowing non-members to see non-public posts

Zohar Stolar z.stolar at gmail.com
Sun Oct 14 07:13:48 UTC 2007


Here is how I did finally:

I used a custom module to add a new permission, called 'view
non-public og posts', and gave it to the right role.
Then I added two access hooks, as follows:

function mymodule_node_grants($account, $op) {
  if ($op == 'view' && user_access('view non-public og posts')) {
    $grants['mymodule_realm'][] = 4;
  }
  return $grants ? $grants : array();
}

function mymodule_node_access_records(
$node) {
  $grants[] = array(
    'realm' => 'mymodule_realm',
    'gid' => 4,
    'grant_view' => 1,
  );
  return $grants;
}

This does two things:

  * Allows users with the right permission to see all posts (including
private og posts). Note that this function should be altered if you
still need to limit the users access to other node types.
  * Still, it accomplishes the need to have a group of users with
non-admin permissions, that can still bypass the OG access limits.



On 10/11/07, Zohar Stolar <z.stolar at gmail.com> wrote:
>
>
>
> Jean Gazis wrote:
>
> Could you create a group just for this role, and do it that way?
>
>   No, because what I need is to have a role for users who are not part of the group, but are like inspectors that can still view what others can't...
>  I have few groups who's members cannot view each other's content (posts are not public), but I still want some of them, those who are part of the specified role, to be able to view all the content in the site...
>  I guess what it should do is over-ride the OG grants in some way.
>
>
>
> On 10/11/07, Zohar Stolar <z.stolar at gmail.com   > wrote:
> > I have a scenario where I'd like to limit posts visibility to group
> >  members only AND to a specific role as well.
> >
> >  Using OG alone I can achieve the first goal - posts are not public by
> >  default and that settles it.
> >
> >  Now I need to allow users of a specific role to see all posts, whether
> >  they're public or not, even if those users are not members of the group.
> >
> >
> >  I've tried og_user_role with ACL and content_access, but had no success....
> >
> >
> >  Is there a module I missed that allows it? Or is it a configuration
> >  issue I'm missing?
> >
> >
> >
>



-- 
Zohar Stolar | זהר סטולר
z.stolar at gmail.com
SkypeID: stolars


More information about the support mailing list