Closed (fixed)
Project:
Taxonomy Access Control
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
27 Feb 2010 at 14:36 UTC
Updated:
25 Mar 2010 at 21:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
xjmThis bug also exists with changes to the global default.
Comment #2
xjmMarked #350204: Forum taxonomy denied access, users can still see nodes as duplicate of this issue.
Comment #3
xjmAttached is just a whitespace cleanup of the submit handler to make troubleshooting easier. (Edit: already tested and committed to CVS).
Comment #4
xjmOne issue I can see is that a vid of 0 (representing the global default) gets passed to
_taxonomy_access_get_nodes_for_vocabulary(), but that function does not handle a vid of zero. If the global default is changed, presumably nodes not controlled by the configurations that follow it should be flagged for update?Also, the submit handler doesn't check which values have changed that I can tell; it just updates everything for every row (including nodes for each term), which will probably result in far more queries than needed. It would be better to check against the initial state of the form, and possibly to refactor so that we don't update the same node multiple times.
Comment #5
xjmThis issue has turned out to be a lot more complicated than I expected. Here's what I suggest:
node_access_needs_rebuild(). (The other way was just too complicated.) (When this flag is set, the new and improved_taxonomy_access_node_access_update()will not bother to update individual nodes.)This should reduce the overhead as much as possible while still ensuring that changes to defaults are processed correctly.
Comment #6
xjmThis patch does the following:
_taxonomy_access_get_nodes_for_vocabulary()so that results are actually returned when a role id is specified.taxonomy_access_defaults_update()so that it flagsnode_access_needs_rebuild()when passed the global default and only runs_taxonomy_access_node_access_update()for real vocabularies.I did not add the refactoring to collect affected node ids and process them all at once since it is not directly related to this issue; I will open a separate issue for that. Edit: #732844: Refactor submit handler to process nodes all at once (rather than per row).
Comment #7
xjmI tested the patch above, and it seems to work fine:
Comment #8
keve commentedGood job. :) Seems to work fine.
Comment #9
xjmCommitted to 6.x-1.x-dev:
http://drupal.org/cvs?commit=337404
Comment #10
xjmThis patch introduces a bug that prevents the global default row from being inserted when a role is first enabled. Unlike other defaults, the global default is not added to the database for the first time until "Save all" is clicked. I'll come up with a fix shortly.
Comment #11
xjmAttached patch inserts the row as soon as the user clicks 'enable' (which is more consistent anyway).
Comment #12
xjmComment #13
xjmPatch applies fine and fixes the issue.
Comment #14
xjmFix committed to dev:
http://drupal.org/cvs?commit=340250