This is a great module. Exactly what I needed! However, I'm having a tough time setting permissions properly and so perhaps I just need a primer.
Use case:
I'm using only two content types "Basic" and "Private". All the basic nodes are created by admin and I want visible (VIEW ONLY) to the world. All private nodes are created by individual users and I want them to manage grants to individual user only for VIEW ONLY access and not by role. I only want the "View" - Allowed grants available to these node authors. I'm not using any other node type access module, unless you count Drupal's default.
If I understand the readme file correctly, once this module is enabled all nodes permissions will be handled by this module? So, I don't need to be concerned with any of the Drupal default settings for Node permissions in admin/people/permissions?
I'm hoping I've given enough info for you to basically tell me what boxes to check in each section of the nodeaccess settings page to make my use case work.
Below is the error I keep getting after trying to save a node.
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-1-nodeaccess_author' for key 'PRIMARY': INSERT INTO {node_access} (nid, realm, gid, grant_view, grant_update, grant_delete) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5), (:db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => nodeaccess_author [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 1 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => 1 [:db_insert_placeholder_7] => nodeaccess_author [:db_insert_placeholder_8] => 1 [:db_insert_placeholder_9] => 1 [:db_insert_placeholder_10] => 1 [:db_insert_placeholder_11] => 1 ) in node_access_write_grants() (line 3564 of /home/xxx/public_html/xxx/modules/node/node.module).
Thank you in advance for any assistance!
Mark
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | nodeaccess-dup_entry_error-2427345-5.patch | 823 bytes | trigdog |
| #3 | nodeaccess permissions.PNG | 11.37 KB | System Lord |
| #2 | nodeaccess.PNG | 17.72 KB | System Lord |
| #2 | node_access.PNG | 55.41 KB | System Lord |
Comments
Comment #1
System Lord commentedComment #2
System Lord commentedI have to be missing something. I can create nodes with no issues, but if I go back to the node and re-save it I keep getting the error above. Both admin and users get this error. Attached is both the nodeaccess table and the node_access table. Maybe it will help figure this out?
Comment #3
System Lord commentedComment #4
System Lord commentedLooks like this issue, or more likely just similar, has been addressed in core. However, I'm using D734 and the patch is included and I still get this error.
https://www.drupal.org/node/1146244
Comment #5
trigdog commentedI think this is a bug in the 7.x-1.x-dev version of this module. After the changes to the module to remove direct calls to node_access_write_grants, the nodeaccess_node_update function was changed from calling node_access_write_grants directly to saving the nodeaccess_author grant to the nodeaccess table but this is not necessary since nodeaccess_node_access_records automatically gets called during node update process also. nodeaccess_node_access_records loads the grants in the nodeaccess table (which will contain the nodeaccess_author grant added from nodeaccess_node_update) and then adds the nodeaccess_author grant a second time to the array before it gets sent on to node_access_write_grants creating the duplicate entry error above.
I have attached a patch with a fix for this.
Comment #6
trigdog commentedComment #7
trigdog commentedtypo ;)
Comment #8
trigdog commentedComment #9
System Lord commentedThanks, trigdog. Testing now.
Comment #10
System Lord commentedNo errors. Thank you! Since you know something about this module can you help me with what the heck "Keep?" is for? https://www.drupal.org/node/2423507 Sorry for using this thread, but I'm trying to find anyone that can help. This module is perfect for me in every way except for "Keep?" Confuses me and my users.
Comment #11
joelpittetThis seems to do the trick in fixing that error message. Tested unpublished/published and anonymous view vs not view. No error after patched;)
Comment #12
jduhls commented#5 patch solved my problem too. Was getting same errors.
Comment #13
jduhls commented@System Lord RE: #10 - agreed: "Keep?" is strange. Module needs some UI/UX work. If you uncheck it then click "save grants", it removes the user from grants.
Comment #14
hugovk commentedvlad.pavlovic, any chance to release this to dev? Thank you!
Comment #16
vlad.pavlovic commentedReleased to dev, sorry for delay.