I'm having an urgent problem stemming from TAC-Lite. (I'm 99% sure it's TAC Lite related, anyway.) I installed TAC Lite and then decided I didn't want to use it, so I unchecked the box in admin > modules. Now, all content that I edit, or any new content that I create becomes inaccessible to anonymous users. This is really bad. Does anyone know how I can fix this? It seems like the opposite to the problem described here, but I'm sure it's related to the same thing: http://drupal.org/node/66509.

Comments

Dave Cohen’s picture

Title: anonymous users can't see content when module is disabled » rebuild node_access when tac_lite disabled
Category: bug » feature
Priority: Critical » Minor

The solution is to rebuild permissions, which an administrator can do at q=admin/content/node-settings

Possibly, the module should do this automatically when uninstalled, or at least provide a message to help.

moshe weitzman’s picture

Category: feature » bug
Priority: Minor » Normal

og does this on hook_uninstall and it works quite well. without this, you really leave sites in a bad state. they can't rebuild when there are no node access modules present.

Dave Cohen’s picture

It bothers me that the "rebuild permissions" button disappears like that. I've spent a while looking for it in the past. But it will appear if there are rows in node_access, even after tac_lite has been disabled.

Do you have any concerns regarding permissions? That is, someone could disable the module without "administer nodes" privilege, and that is usually required to rebuild the permissions. Also, the rebuild could take so long, should it really be done on uninstall without any confirmation? (I think the answer is yes, but not sure).

gpk’s picture

Or you could use http://api.drupal.org/api/function/hook_disable/5 - it's after disabling the module that I often needed to do this rather than after uninstall. Presumably the best you could do with this would be to output a dsm, since rebuilding the permissions while tac_lite is still enabled would presumably not have the desired effect (well, I imagine it would be slightly harder to get this to work)?

Yes, the button rebuild permissions button *should* be there (and is, at least usually!) after disabling tac_lite.

nancydru’s picture

Actually if TAC_lite is your only access control module and you disable it, the rebuild button probably WILL disappear.

From node.module:

Only show rebuild button if there is 0 or more than 2 rows in node_access table, or if there are modules that implement node_grant.

Leeteq’s picture

There should be information about this in the text describing the module on the module page.

nancydru’s picture

There are many posts in the forums about this. "Experimenting" with access control modules is a recipe for disaster. One should not be installing modules unless one has a documentable need for them. Uninstall procedures are getting better, but this is an area that many contrib developers just don't spend much time at.

gpk’s picture

AFAICS the Rebuild Permission button is normally available immediately after disabling TAC_lite since in most cases you won't have just 1 row in {node_access}. After rebuilding then the button does disappear. The main problem I can see is on test/experimental sites when the module has only inserted one row in {node_access} and then the button won't appear after the module is disabled. This is a separate core bug I suggest.

@Dave Cohen (#3): I think that if someone has sufficient permissions to enable/disable the module and thereby "leave the site in a really bad state" then they should be allowed to rebuild the permissions. The problem with how long the rebuild takes could be handled in D6 via Batch API.

In D5 maybe therefore a convenient way forward is just to implement something like:

/**
 * Implementation of hook_disable().
 *
 * Perform necessary actions before module is disabled.
 */
function tac_lite_disable() {
  // Warn user to Rebuild permissions (on the Post settings page).
  drupal_set_message(t('You have chosen to disable the Taxonomy Access Control Lite module. To ensure that node access permissions are correct, you may wish to rebuild the permissions by visiting the <a href="@post_settings">Post settings</a> page and clicking on "Rebuild permissions".'), array('@post-settings' => url('admin/content/node-settings')));
}

You could even link directly to the admin/content/node-settings/rebuild page, but that might be counter-productive given that that's not the usual way of getting there.

Although node_access_rebuild() is not called in tac_lite_install() - which is fair enough since in order to get the module to do anything the user has to visit the tac_lite settings page (after which the permissions *are* rebuilt), a rebuild can be necessary after re-enabling the module (e.g. disable it, rebuild permissions, then re-enable: the {node_access} table will now have just the default row). Therefore IMO it would be useful if a similar message were output via hook_enable().

@DanielTheViking: maybe you could suggest some updated texts to Dave which emphasise the point about Rebuilding permissions, for him to use on the module's Project page, in the README.txt and on the Help page the module provides.

Hope this is helpful,
gpk

Update:

Note : As of Drupal 6, node access modules are not required to (and actually should not) call node_access_rebuild() in hook_enable/disable anymore.

(See http://api.drupal.org/api/function/node_access_rebuild/6.) Although I should say it looks as though the rebuild *only* happens automatically if you have just disabled a node access module and none remain enabled. In all other cases, a flag "node_access_needs_rebuild" is set, which will cause an appropriate warning/error message to be displayed prominently.

Leeteq’s picture

On the module page, add this text:
"PS. You may need to rebuild the nodes permissions table when disabling/uninstalling this module (ref. readme.txt)."

And under "Notes" in Readme.txt, change this:
"If behavior of this or any other access control module seems to be incorrect, try rebuilding the node access table. This may be done under administer >> content management >> post settings. There is a button there labelled "rebuild permissions"."

To this:
"Either if experiencing problems, or when disabling/uninstaling this module, you may need to rebuild the node access table (permissions). For that, you need the "administer nodes" permission. A rebuild button can be found at administer >> content management >> post settings."

Add an "Uninstall" section with this text:
- see "notes".

tinker’s picture

Status: Active » Closed (won't fix)

5.x version no longer supported.