I've created a small patch to give this module more flexible permissions. After patching, there will be four different permissions to assign:

  • add child relations
  • remove any child relation
  • remove child relations of own nodes
  • view link operations

Comments

jjalocha’s picture

Joonas, your patch seems to solve exactly the issue I am facing now: I need that other users than the authors are able to link the nodes, or create child nodes.

I would like to test your patch, but I don't know hot to patch software! Yesterday I downloaded a module from CVS for the first time in my life, under the guidance of the module author.

Maybe you could help me with this patch?

Thank you for your work.
Cheers,

Jerzy

PS: The Relativity access module seems to do the same thing for Drupal 5?

merilainen’s picture

I modified dev-version of relativity-module, so you should be able to patch it with the common instructions http://drupal.org/patch/apply
I made this patch for my own use, and decided to share it here, because I remembered that someone had similar problems, I just couldn't find the right thread. Maybe there is something what could be applied to next dev-version of relativity.

I didn't notice Relativity access module, they should update it for Drupal 6. They probably have put more thought to the functionality than me, after 5 minutes of "braistorming" :)

jjalocha’s picture

Joonas, I've been reviewing the possible solutions, and your patch might be the only single alternative that is working right now:

All other promising D6 projects look semi-abandoned, or the authors have no time for development. I didn't go back to CCK Node reference with the additional modules, yet, but I doubt that this provides as much functionality as any of the "hardcore" relationship modules.

Thank you very much for the patching instructions, I was able to apply it, and am testing it right now.

Cheers,
Jerzy

jjalocha’s picture

Joonas, your patch seems to run without flaws for child nodes with exactly one parent.

For Parental Ordinality of 'any', I get the following errors:

  • 'Attach existing node' for a user without edit permissions, the link is simply unavailable.
  • In all other cases, 'Attach existing node' link does show up, but I get an 'Access denied' error.

Setup Details

Three content types:

  • Conflict: 'none' parents, 'Resource' & 'Solution' childs
  • Solution: 'one or many' parents, no childs
  • Resource: 'any' parents, no childs

With 'Enforce Parental Rules' setting.

Two users & roles:

  • user: can create all three content types, and edit own nodes. 'add child relations' and 'view link operations'
  • editor: additionally 'edit any' nodes for all three types

Test Details

Create content: Resource (node/add/resource)
[editor] => Resource1
[user] => Resource2

Create content: Conflict (node/add/conflict)
[editor] => Conflict3
[user] => Conflict4

Conflict3 [editor]
 * Create new Solution (node/add/solution/parent/3)
   [editor] => Solution5
   [user] => Solution6
 * Create new Resource (node/add/resource/parent/3)
   [editor] => Resource7
   [user] => Resource8
 * Attach existing Resource (relativity/listnodes/resource/parent/3)
   [editor] => Access denied
   [user] => Link not available!

Conflict4 [user]
 * Create new Solution (node/add/solution/parent/4)
   [editor] => Solution9
   [user] => Solution10
 * Create new Resource (node/add/resource/parent/4)
   [editor] => Resource11
   [user] => Resource12
 * Attach existing Resource (relativity/listnodes/resource/parent/4)
   [editor] => Access denied
   [user] => Access denied
jjalocha’s picture

Update to the previous tests

I get exactly the same test results as above with all combinations of the following settings:

  • Parental ordinality for Resource: 'any', 'one or more', or 'none'*
  • Enforce Parental Rules: active or inactive

This effectively means, that this patch can't deal right now with nodes that do not have exactly 'one' parent.

*Actually, a parental ordinality of 'none' for the Resource node type is an invalid setting, because it conflicts with the 'Allowable Child Node types' setting of 'Resource' & 'Solution' in this test set-up. But this is an error in the Node relativity module, and not of this patch.

merilainen’s picture

StatusFileSize
new3.96 KB

Thank you for testing my patch.

In my setup I only have one parent for my child, so I didn't even notice the existence of this "Attach existing content" functionality.
I do not understand all the logic behind the module, so it's quite probable that my patches won't work perfectly. Basically I'm just replacing all the node_access('update', $node) calls with user_access($permission) calls, which means that the user don't have to be the author of the node, but he needs to have permission to add/remove child nodes.

To include this functionality in the module itself, we should define who can do and what more precisely.

Anyway I made another patch which you may try.

jjalocha’s picture

Joonas, I followed the complete testing procedure from post #4 on a clean install with patch2 and everything works perfect now. 'Attach existing Resource' gets linked as expected for all combinations of both users with both user's contents (on parents and children) .

I will keep working with this module, and report back if any issues or questions arise. (With due time, I'll also try to take a look into the code, and try to understand a little bit, even if I'm not a developper.)

I am really very thankful that you took the time to fix this issue that was not in your interest at all. I really want to give you a huge THANK YOU!

@darius: Do you plan to include this patch in the 1.x branch? I would surely volunteer as a tester :)

Cheers,

Jerzy

chawl’s picture

Patch is OK. Now "Create new child" link can be exposed without giving user the edit rights for the parent node type.

I am for that patch should be committed.

chawl’s picture

Status: Needs review » Reviewed & tested by the community

Thus...

davea’s picture

Status: Reviewed & tested by the community » Closed (fixed)

#6 is now committed.

Thanks,
Dave