I encountered this bug in the Rules integration after updating to the latest dev version.

To reproduce:

  1. On a clean D7 install, enable rules, content_access and content_access_rules
  2. Turn on rules debug log
  3. Edit Article content type and check "Enable per content node access control settings"
  4. Create a rule that changes content access permissions on content creation
  5. Create an Article and save it
  6. You should find that the newly-created article's content access permissions have not changed, and this Rules debug error is logged: "Can't set per content permissions for content type article. Make sure to have per content settings activated for content types you want to alter access control for."

It seems that the function _content_access_rules_check_setting() in content_access_rules.rules.inc hasn't been updated to reflect recent changes in storage format for settings.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

auberdjinn’s picture

The attached patch fixed the issue for me. Repeat step 5 after applying the patch and you should find the error is not there this time and content access permissions on the new article have changed according to the Rule.

auberdjinn’s picture

Ok, so this time I paid attention to formatting. My apologies! Replaces above patch.

auberdjinn’s picture

OK, so I screwed up the patch naming as well, but let's just pretend it's attached to this comment, eh?

auberdjinn’s picture

Oh, where did my patch go? I'm sorry, I didn't notice it was 0 bytes earlier! Not sure what happened there. Will try to upload it again once I get back to the machine it's residing on. I promise, depsite my apparent inability to perform the simple task of naming and uploading a patch, it really does work ;-)

good_man’s picture

Status: Needs review » Needs work

Hello catfink, if you are unable to upload a patch, try pasting it (if it's a small code) in code tag. Also try hitting the upload button then submit the comment.

good_man’s picture

Status: Needs work » Needs review
FileSize
849 bytes

Here is a patch to solve this. Waiting your review.

auberdjinn’s picture

That's pretty much what my patch looked like :) Sorry you had to reproduce the effort, and thanks for doing so.

I've tested your patch and it fixes the issue for me.

good_man’s picture

Status: Needs review » Fixed

Thanks for reporting, committed and it'll appear in the dev version after some hours :)

good_man’s picture

Issue tags: +Needs tests

Tagged as needs tests.

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