I realized that content access settings are not deployable. And I want to find way how to manage it.

I will explain problem with an example:
I have local and development Drupal installations. And I want to move local content_access settings to development installation.
Let's say I want to grant "View any page content" settings only for role "Authentificated user".
Each content_access setting of each content type is stored in separate variable. And I can export it with Features and Strongarm.

After feature reverting on development installation content_access settings appears on settings from "/admin/structure/types/manage/page/access".

But anonymous users still can see all content types of type "page"! Settings are not deployable correct now.
Content_access needs call of content_access_mass_update() to rebuild node_access_records.

But I can't run in after feature revert. Because there is no hook in features. The only thing I can do is add content_access_mass_update() in hook_update. But than I will need to run this hook after each permissions change.

There are some related issues about deployment. But with no answer on my question:

Any ideas?

Comments

FMB’s picture

My solution is to force permissions to be rebuilt when all the caches are cleared:

/**
 * Implements hook_flush_caches().
 */
function MODULE_flush_caches() {
  $types = array('CONTENT_TYPE_1', 'CONTENT_TYPE_2');
  module_load_include('inc', 'content_access', 'content_access.admin');
  content_access_mass_update($types);
}
a.milkovsky’s picture

That will work. But in this case you will run it on every cache flush. Better to run it once using hook_update_N().

FMB’s picture

Sure thing, but I wanted to be absolutely sure permissions were rebuilt every time we deploy, no matter what ;-) Since my colleagues are trained to flush all cache after every deployment, that does it for me™...

gisle’s picture

Version: 7.x-1.2-beta2 » 7.x-1.x-dev
Status: Active » Closed (outdated)

This issue has not received any updates in the previous 6 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