Add permission to disallow anonymous users from viewing "public" nodes

Created on 18 January 2010, almost 15 years ago
Updated 27 October 2024, about 2 months ago

Hi, I'd like to add this to my own site and figured I'd check to see if anyone else was interested in this...

I have a site with fairly strict access controls - currently anonymous users are locked out completely. I'd like them to be able to view a small selection of content that's been specifically marked as "external." However, I'm also using OG to restrict visibility of some content even to logged-in viewers. In my context, I want "og_public" to mean "viewable by all logged-in viewers but not anonymous viewers." I'll then use my own custom module to grant some access to select content.

The fix is pretty simple. In og_access_node_grants, replace this:

  if ($op == 'view') {
    $grants['og_public'][] = 0; // everyone can see a public node
  }

With this:

  if ($op == 'view' && user_access('view public group content') ) {
    $grants['og_public'][] = 0; // everyone can see a public node
  }

plus the necessary boilerplate code to get the permissions right.

So - is this a feature that might make it into the build?

Feature request
Status

Closed: outdated

Version

2.0

Component

og_access.module

Created by

🇨🇦Canada aludwin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024