Problem/Motivation
When ever any change is made to a User Role, even simply renaming the Role, the update hook is called and the a node access rebuild flag is set. Node access rebuild is an incredibly time consuming process for large websites with thousands of node.
The node access table only needs rebuilding if permissions have changed, and only the permissions that this module uses.
Steps to reproduce
Edit a Role and change it's name, not even changing a permission.
You will now have the warning message to rebuild all of the node access permissions even though no permissions have changed.
Proposed resolution
Only call node_access_needs_rebuild(TRUE); if a permission has changed in a role that will effect any of the filters that this module adds.
I have patched the views_node_access_filter_user_role_update(EntityInterface $entity) method to only call the rebuild function if a role has either gained or lost one of the following permissions:
- 'edit any [TYPE] content'
- 'edit own [TYPE] content'
- 'revert [TYPE] revisions'
This should reduce the amount of times that the node access table is flagged to rebuild.
I'm not sure if that is the correct set of permissions to monitor?
| Comment | File | Size | Author |
|---|
Issue fork views_node_access_filter-3383350
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
altcom_neil commentedComment #3
akshay.singh commentedComment #4
altcom_neil commentedComment #7
prudloff commentedI created a MR from the patch to make this easier to review.
phpcs reports a problem: https://git.drupalcode.org/project/views_node_access_filter/-/jobs/4764202