The following scenario is given:
Drupal7, rules 7, content access (beta version) and Postgresql are used.
When a webform is saved rules triggers setting of permissions. At initial saving, this fails. Following error message occurrs:
PDOException: SQLSTATE[23505]: Unique violation: 7 errors: Unique-Constraint »node_access_pkey«: 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); Array ( ) in node_access_write_grants() (line 3440 drupal7/modules/node/node.module).
Saving the document without using rules integration and setting permissions later works well.
The patch attached solves this problem.
Cause: Rules integration of content access checks the node operation which initially is 'save'. If this is not the case (such as 'update' it will trigger node_access_acquire_grants($node).
So initially this shoud not happen because of multiple calls of this method (see comment of the integration).
Nevertheless, this happens due the German localization of Drupal is used and the operation is translated, too.
Hence, t('save') has to be compared against instead of 'save'.
Please apply this patch in the upcoming release as quick as possible.
Comment | File | Size | Author |
---|---|---|---|
#6 | content_access-translation_fix-1892104-6.patch | 698 bytes | gilsbert |
content_access_rules.patch | 640 bytes | lollipopp | |
Comments
Comment #1
lollipopp CreditAttribution: lollipopp commentedComment #2
lollipopp CreditAttribution: lollipopp commentedWhen is this patch gonna be integrated?
There is still the same problem with the beta2 version.
Please integrate the patch asap.
Comment #3
wescleyteixeira CreditAttribution: wescleyteixeira commentedI also have this trouble. I tried to pass an user profile information to a content type when a new node is created via rules and i receive this message. Disabling Content Acess my site works fine.
Comment #4
colanComment #6
gilsbert CreditAttribution: gilsbert commentedHi.
I wrote a new patch.
All the credits should be given to "lollipopp" who wrote the original patch!
I'm just trying to fix the automatic test failures.
Anyway I would ask to content_access's maintainers to fix the code even if my patch fails too.
It is very simple: just check what lollipopp suggested. It is only one line to be changed!
from:
- (isset($node->op) && $node->op != 'Save')) {
to:
+ (isset($node->op) && $node->op != t('Save'))) {
I tested my patch using the last "git" and the last "dev" version and I got success on both of them.
Regards,
Gilsberty
Comment #8
gisleThis is fixed in 7.x-1.x-dev.