When user grants access to the node for the relationship member, the relationship member can access the node even if it is unpublished.

CommentFileSizeAuthor
#7 node_access_unpublished.patch1.28 KBberdir

Comments

anglo’s picture

Relationship member is granted only the view permission. With the view permission he shouldn't be allowed to access the unpublished node.

berdir’s picture

Yes, there needs to be a check for $node->status in the function user_relationship_node_access_node_access_records().

Should be a trivial, one-line change. I probably will not have time to do this in the next few days, so it would be great if you could provide a patch.

anglo’s picture

Unfortunately, not that good with node access grants. If you could provide me with the code I can test it.

berdir’s picture

You don't need to be good with anything. You just need to extend the existing if case that checks if there is any UR node access related information with a "&& $node->status".

anglo’s picture

Tried yesterday to put it in user_relationship_node_access_node_access_records() both here

if (!isset($node->user_relationship_node_access) && $node->status) {

and here

if (isset($node->user_relationship_node_access) && is_array($node->user_relationship_node_access) && $node->status) {

Doesn't work. Once the node is published the checkbox "Post to a friend" gets unticked and everyone can see the node.

And I get

Notice: Undefined offset: 1 in user_relationsihp_node_access_update_node() (line 238 of /sites/all/modules/user_relationships/user_relationship_node_access/user_relationship_node_access.module).

mrf’s picture

Not sure if this has been fixed yet, but updating tags for tracking.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new1.28 KB

You probably changed two much if you changed two if statements.

I've justed changed a single diff in the node_access_records() hook and it is working fine for me. Please test the attached patch.

berdir’s picture

Status: Needs review » Fixed

Committed.

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