Strange OG duplicated node permission error

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
btopro's picture

I hope someone has run into something like this before... I'm using a group who's form duplicates nodes and automatically associates them to the new group. So you create a group, select a book in the system and it will grab the book, duplicate it and set the og node settings to the new group. Then it performs a node_save after removing the nid so it's a "new node" with the old content / hierarchy.

That's all working great, the weird thing is... it will duplicate everything, it'll associate to the new group correctly, it'll lock access to the new group. But no matter what I do, the "access nodes" permission allows anyone to see the content initially. If I pull up the devel stats I get this http://bit.ly/g0GEiG

You can see that og_public is set (even though I'm nullifying it) and anonymous users / everyone has access to the new node via the "access content" permission. Now I'd chalk it up to a code problem except if I go and hit edit, then save the node the issue resolves itself (see http://bit.ly/h7JP6M ).

Has anyone else run into anything weird like this with OG and access modules? I'm not using anything weird for access, just OG and Spaces_og to generate the og_public distinction (which is marked 0 anyway).

Comments

Have you tried setting

BTMash's picture

Have you tried setting og_public to 0 or FALSE? Also, how is it getting associated with a group (is it an array?) I think setting it to null makes it think that it would be public otherwise. Any code that you can provide would be helpful in debugging this.

I was able to set og_public

btopro's picture

I was able to set og_public to false but I didn't want it to be false ALL the time, only when the spaces config said to be. Finally got it figured out, had a switch to a different nodeapi op (insert) in a different module, set at a different weight.

It was a weighting issue mostly cause I was creating a node (group node) which would then (after insert) duplicate a premade book-structure and set the group to the nid of the node that was just created. The issue is that the og access / spaces code to set things like og_public was happening before the group was finalized which caused it to create a node structure as part of a group that was technically private, but hadden't been told by drupal yet that it was private. This caused it to look like it was private when I went to a node in the group and hit edit, yet it didn't have the same access restrictions because they didn't exist at the time of creation (really weird i know).

Guess that's what I get for doing automated node creation on node creation though :p