Hi.

I need to integrate content_access with the module search_api.
That way everytime a node gets a change in the access control's information the module search_api will be alerted to reindexed it.

I tried to use the module "rules" using the steps below.

1) selecting the event "Per node access control was changed"

I believe this step is the only one correct but it would be good to have a feedback if this is the correct event.

2) selecting the condition "Node / Content is of type"

The objetive of this step is to make the rule works only for one specific content type.
I can't finish that step because there are only two "data selectors":
- site:current-user
- site:current-page

I would need a "data selector" like node:content-type or something similar, right?

Even selecting one of that two I get the error message: "Missing required module 0.".

3) selecting the action "Search api / Index an entitty"

In this action I can point the correct index for seach_api but once more there is no good "data selector" avaliable (I get the same as before site:current-user and site:current-page).
I believe I would need node:nid or entity:entity_id as my data selector to make it work.

Is it possible to use rules to integrante content_access with search_api?

Is it possible to make it by a hook? What function inside content_access module should I hook?

Regards,
Gilsberty

Comments

gilsbert’s picture

Hi.

I did find a workaround. I'm posting it here so if you have the same need perhaps you might use this temporary solution.

I created a new list/integer field on my content type to allow the user choose the roles that should have permission for view the node.

Then I create a new rule using event "after the node is saved" and I setup conditions to check wich role was choosen (using the new field) and actions to update the access_control list accordingly.

The integration with search_api is made by the edit/save node actions!
The record is marked as "dirty" and search_api will reindex it.

Of course I do prefer to use event "acl change" and actions to mark the node "dirty" as requested in my original message.

Regards,
Gilsberty

gisle’s picture

Version: 7.x-1.2-beta2 » 7.x-1.x-dev
Status: Active » Fixed

gilbert,
thank you for responding to this support request.
I've credited you.

Status: Fixed » Closed (fixed)

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