Problem/Motivation
Currently, the Entity Mesh module only analyzes links that are visible to anonymous users.
However, some sites we want to analyze are not accessible to anonymous users, so we can use the module in this context.
We need to extend Entity Mesh so that site administrators can configure which user role(s) should be used when crawling and analyzing links.
By default, the module should continue to behave as it does now (use the anonymous role), but it should allow selecting other roles through configuration.
This would make the module usable for a wider range of scenarios, especially for websites where access control is based on authenticated roles.
Steps to reproduce
- Install and enable the Entity Mesh module.
- Attempt to analyze a site where most or all content is restricted to authenticated users.
Observe that:
- Entity Mesh only analyzes links visible to anonymous users.
- Links restricted to authenticated or custom roles are skipped.
There is currently no configuration option to analyze the site using a different role.
Proposed resolution
Add a module configuration setting to choose which user role(s) Entity Mesh should use when analyzing links. By default, use the anonymous role for backward compatibility.
Reuse the functionality already proposed in issue #3535302, which implements the ability to generate a fake account object and assign roles dynamically.
Extend that implementation to:
Replace the hardcoded instantiation of new AnonymousUserSession() in EntityRender.php line 303 with the new role-aware account system.
Review any entity access checks within the module to ensure they respect the configured roles.
Remaining tasks
Add a configuration form to select the role(s) used for crawling.
Extend the fake account functionality from issue #3535302 to support configured roles.
At this point, there are two options:
- either continue with the approach used in this issue, which involves changing the account globally in each processing step,
- or implement a more refined solution, which would require at least the following two actions:
- Replace new AnonymousUserSession() calls with the configurable fake account object.
- Audit all access checks in the module to ensure they use the configured roles.
- Add tests to confirm:
- Default behavior remains anonymous-only.
- Configured roles are respected during link analysis.
- Update module documentation.