dev/drupal#89 Drupal 8 version of checkGroupRole #16273
Merged
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
Follow-on from #15318. The UI for the roles widget on the Access tab of CiviReports is fixed by that PR but it doesn't actually have any effect on access because the implementation of CRM_Core_Permission::checkGroupRole ends up using the D6/D7 version which doesn't work in D8. So that needed updating too, which is this PR.
Before
You can select a role but it doesn't affect access.
After
Role-based access works like in D7.
Technical Details
$GLOBALS['user'] doesn't exist in D8. This adds an override version of checkGroupRole in Drupal8.php.
Comments
If you're testing note that if the user has Administer Reports permission in the CMS then that overrides anything on the access tab of a report.
@jitendrapurohit