I've ported ACL to D6 and I really like the changes in that area, but it's not quite working correctly yet.

When I install ACL, then I get "The content access permissions need to be rebuilt. Please visit this page." This is node_access_needs_rebuild() at work, as intended. However, when I disable ACL, I get "Content permissions have been rebuilt," so apparently, this automatically calls node_access_rebuild(FALSE). Shouldn't it call node_access_needs_rebuild() instead, too?

Secondly, if I do go to admin/content/node-settings/rebuild and click [Rebuild permissions], then I'm redirected to batch?op=start&id=123 with a title of "Rebuilding content access permissions", but nothing else happens. I have to click the browser's [Go] or [Refresh] button, then the rebuild proceeds and I finally get redirected to admin/content/node-settings.

I expected this to proceed automatically and to provide a fall-back mechanism of the sort "If your browser does not redirect, click here to go to the next page." My browser does redirect though, I've verified this on http://www.pageresource.com/html/refex1.htm.

Thirdly, when I get to admin/content/node-settings, then I see

* The content access permissions need to be rebuilt. Please visit this page.
* The content access permissions need to be rebuilt. Please visit this page.
The content access permissions have been rebuilt.

Only the third message should be displayed.

The ACL port is in HEAD (http://drupal.org/node/96794) and I have yet to test it, but I think it handles installing/disabling/uninstalling correctly.

Comments

yched’s picture

Title: Node access module install/uninstall does not work as expected » Batch 'rebuild n_a permissions' not working ?

However, when I disable ACL, I get "Content permissions have been rebuilt," so apparently, this automatically calls node_access_rebuild(FALSE). Shouldn't it call node_access_needs_rebuild() instead, too?
It does, but when there remains *no* enabled n_a module, rebuilding n_a rights is dead-easy and fast (drop all, insert one record), so it is done at once. This is the expected behaviour.
If, when disabling ACL, there still was another n_a module around, you'd get the ""The content access permissions need to be rebuilt" message.

The other part about the batch at admin/content/node-settings/rebuild not starting is intriguing, though. I'll try to look into that.

yched’s picture

Secondly, if I do go to admin/content/node-settings/rebuild and click [Rebuild permissions], then I'm redirected to batch?op=start&id=123 with a title of "Rebuilding content access permissions", but nothing else happens. I have to click the browser's [Go] or [Refresh] button, then the rebuild proceeds and I finally get redirected to admin/content/node-settings.

OK, I actually tested this with the current ACL HEAD, and cannot seem to reproduce. When I hit the [Rebuild permissions] button, I get the expected 'active' progress bar and the task performs OK.
Could you please check other batch processing tasks work OK for you? For instance, go to admin/content/node, select *more than 10 nodes* and 'publish' them (doesn't matter if they're already published).

Third point is about duplicate 'The content access permissions need to be rebuilt (...)' messages.
After enabling ACL, I get the message ok, I rebuild the permissions as advised, and on the page after batch rebuilding, I get both 'The content access permissions need to be rebuilt ' warning message AND 'The content access permissions have been rebuilt.' success message, which is sure awkward. I need to investigate where this last unrelevant warning comes from.

yched’s picture

Title: Batch 'rebuild n_a permissions' not working ? » Contradictory messages after n_a rebuild
Status: Active » Needs review
StatusFileSize
new824 bytes

Quite silly :-) The extraneous 'permissions need to be rebuilt' message is issued on the batch processing page itself, because n_a perms haven't been rebuilt *yet*. Batch progress pages being themed without messages display, the message only surfaces on the 'finished' page.
Atteched patch fixes the logic to not generate the message on batch processing pages.

Changing title, as the other buggy behavior reported in the original post still has to be confirmed.

salvis’s picture

Status: Needs review » Reviewed & tested by the community

The patch takes care of the contradictory message(s). I apparently get two of them, because I have to reload the page, and they're both gone.

Thanks for explaining the node_access_needs_rebuild() vs. node_access_rebuild(FALSE) situation -- that makes perfect sense.

Your suspicion is correct that the other batch operation doesn't proceed either on my system. I guess I have to open a new issue -- any hint where I should place it?

yched’s picture

I guess I have to open a new issue -- any hint where I should place it?
Right, that would be best. File it under, hmm, 'base system' ? (not sur where batch-related bugs belong... no big deal)
Please specify whether your JS is enabled or not :-)

salvis’s picture

Ok, redirect issue reposted at http://drupal.org/node/207123.

Thanks!

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Needs review

Hm, why does node_help() inject these messages in the first place?

yched’s picture

@Gabor : This was introduced back in http://drupal.org/node/144337.
In short : batch workflow is 1st targetted for 'simple' execution contexts like form submission. Having an API function like node_access_rebuild trigger a batch action can lead to unexpected results, because it can be called from virtually any execution context.
Thus, recommended way is to use node_access_needs_rebuild() to put a flag stating a rebuild is required. This displays a message to site admins on every page, advising them to go and trigger the rebuild on admin/content/node-settings/rebuild.
But there are a few pages where the message shouldn't be displayed, because the user is precisely taking care of this.

gábor hojtsy’s picture

OK, so it is about "bug the user to do the rebuild until it is done". Let's document it there. This use of hook_help() is quite non-standard, and it would keep others puzzled as well. I know this patch just modifies it and it was introduced earlier, still I think it is important to add a line of docs here and commit with that.

yched’s picture

StatusFileSize
new1.3 KB

This use of hook_help() is quite non-standard
Possibly. This was taken from update.module that does the same about missing secutity updates (yes, this can be read as "it's not me, they did it first !" :-) )

Updated patch with proper comment.
(edit : hit the right button and actually attach)

gábor hojtsy’s picture

Status: Needs review » Needs work

$ patch -p0 < n_a_rebuild_messages_0.patch.txt
patching file modules/node/node.module
patch: **** malformed patch at line 26:

Otherwise looks good!

yched’s picture

Status: Needs work » Needs review
StatusFileSize
new1 KB

D'oh. That's me manually editing the patch to remove an additional change in my local code, and I foobared that part...
Should be better now.

gábor hojtsy’s picture

Status: Needs review » Fixed

Committed, thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

salvis’s picture

Status: Closed (fixed) » Active

If I enable ACL and Forum Access at the same time (not an unlikely scenario, because FA has ACL as a prerequisite), then I get:

* The content access permissions need to be rebuilt. Please visit this page.

* Content permissions have been rebuilt.

dpearcefl’s picture

Is this still an issue? Any one what to roll a patch?

salvis’s picture

Status: Active » Closed (cannot reproduce)

Apparently has been fixed, works fine in D6 and D7.