Permissions patch
mErilainen - May 18, 2009 - 11:43
| Project: | Node Relativity |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | mErilainen |
| Status: | needs review |
Description
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
| Attachment | Size |
|---|---|
| relativity_permissions.patch | 2.84 KB |

#1
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?
#2
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" :)
#3
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
#4
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:
Setup Details
Three content types:
With 'Enforce Parental Rules' setting.
Two users & roles:
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
#5
Update to the previous tests
I get exactly the same test results as above with all combinations of the following settings:
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.
#6
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 withuser_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.
#7
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