Hi, my Drupal 7 site really depends on the ability to set access rights per node programmatically. I wanted to do that with Rules, as I did in D6. I noticed that this is not working in D7, although the actions are avaialable in Rules.

Is there a work-around to do the job in Rules via the "Execute custom php code" option.

Comments

wolti’s picture

I experienced the same behaviour on my testsystem. I tried to revoke the "per node" rights for basic pages for the annonymous user and i does not work. The same happens to own content types with "per content" access rights (again revoked annonymous view rights (all))

The setup is used with the forum access module in addition to the control access (forum access control is working).

good_man’s picture

Can you provide more info, are all actions unaccessible? did you notice the change in Rules api in D7? please post more info, the more the better.

Goofy2k’s picture

I get an error message when editing a rule. When I try to add an action "Revoke access by role" I get:( 6 times) the Notice: "Array to string conversion in RulesTokenEvaluator->prepare() (line 152 of customers///httpd.www/sites/all/modules/rules/modules/system.eval.inc)"

when I go on: (neglecting the Notice):

"Fatal error: Call to undefined function content_access_action_settings_form_submit() in /customers///httpd.www/includes/form.inc on line 1430"

I did not notice the change in Rules api in D7. I installed D7 only recently and started a fresh site. I have not been active for about a year. If I remember well I could use such type of actions in D6.

good_man’s picture

So if I understand #3 correctly, you tried to do that from Rules UI, not yet in code right? can you try the dev version of Content Access as it contains many bug fixes in Rules integration?

Goofy2k’s picture

Thanks good-man !

Indeed I tried to do this from the Rules UI. So, I wasn't even succesful in adding the action.

I tried this again with the 7.x-1.x-dev version from 2011-Dec-01. Now I can add the action !

So now I can proceed with implementation of my rule-set.

kmare’s picture

I also wanted to report that I had the exact same problem, but with the latest content access 7.x-1.x-dev version from 2011-Dec-01 everything works as expected.

Thank you!

AlanO’s picture

Component: Miscellaneous » Code
Category: support » bug
Priority: Major » Minor

I had the exact same issue as well. I'm using 7.x-1.2-beta1 version. I was still able to get things done but error messages are still there, all six of them.

wreckage’s picture

Hello all.

I'm slowly wrapping my head around Content_Access, but how can I prevent node views on my Forum page when 'Forum' doesn't show as a node under STRUCTURE > CONTENT TYPE > ??

"Forum Topic" shows, and unregistered users cannot open the forums, but they can still navigate to the page, and the 'Forum' menu tab is still visible and usable by unreg. users.

I also have Advanced_Forum installed. Is there a way I can make my Forum page into a 'node' so I can apply view permission on it?

Can somebody please help me to resolve this problem? I'm sorry that I don't understand about using 'Rules' yet. Should I use that to help me?

Thank-you.

Regards,

dankoB’s picture

I have the same problem as wreckage. I would like forums to only be for registered users (and only particular registered users). Anonymous users don't have a menu item heading to the forums, but they can get to the main forums page directly. There they see a list of all the forums. These show 0 values for the number of topics and posts and n/a for the Last post, but I would like it if they could not even reach this main page at all. Unfortunately they can even go one step further into the site since the listed forums have active links to their individual pages. Do we need to use the Rules module to limit this access? As wreckage pointed out, these main Forums pages are not a type of content, so how do you limit access to these nodes?

salvis’s picture

For forums you should probably use the Forum Access module...

dankoB’s picture

Thanks! That seems to do it. Though I'm a bit concerned at my ever growing number of installed modules -- whether I really need all of them and whether they will play nicely together. This one required two others to be installed as well. And there are several spots now where access is controlled, including content_access and og_access, so I hope I get all the permission settings right. Fortunately there's a nice note within the module discussing the interaction of the access modules.

gisle’s picture

Version: 7.x-1.2-beta1 » 7.x-1.x-dev
Issue summary: View changes
Status: Active » Closed (outdated)

This issue has not received any updates in the previous 7 years. If you believe it to still be relevant, you are encouraged to reopen the issue and update it.

If you got an email about this Issue status update, it is because you at one time (possibly a very long time ago), subscribed to it. To learn how to unsubscribe yourself, please visit: https://www.drupal.org/project/webmasters/issues/3142987