Degrade consistently when civi_report not enabled but logging is #28864
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Degrade consistently when civi_report not enabled but logging is
Before
If logging is enabled but Civi-report is disabled a user with 'Admiister CiviCRM' who accesses the Change Log table will see
A non-admin user will see
After
Both users see
Technical Details
The code to determine if the report is accessible uses a (deprecated) BAO function that just looks it up in the database. It finds the report even if CiviReport is disabled and then internally does a permission check based on the db record. Hence for the admin user it attempts to load the report because nothing in the lookup it is doing tells it the report is disabled.
This switches to loading the report using a permissioned api call which delegates the permission checking to civi-report and will also fail / return FALSE if civi-report is disabled.
Note that separately I put up a PR to warn about this configuration #28863
Comments