protected function ContentReportActivityContext::getRolesWithPermission in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRolesWithPermission()
- 8.6 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRolesWithPermission()
- 8.7 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRolesWithPermission()
- 8.8 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRolesWithPermission()
- 10.3.x modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRolesWithPermission()
- 10.0.x modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRolesWithPermission()
- 10.1.x modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRolesWithPermission()
- 10.2.x modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRolesWithPermission()
Returns the role with the required permission.
Return value
array A list of Role IDs.
File
- modules/
social_features/ social_content_report/ src/ Plugin/ ActivityContext/ ContentReportActivityContext.php, line 48
Class
- ContentReportActivityContext
- Provides a 'ContentReportActivityContext' activity context.
Namespace
Drupal\social_content_report\Plugin\ActivityContextCode
protected function getRolesWithPermission() {
$roles_with_perm = [];
/* @var \Drupal\user\RoleInterface[] $roles */
$roles = Role::loadMultiple();
// Check for each role which one has permission to "view inappropriate
// reports".
foreach ($roles as $role) {
if ($role
->hasPermission('view inappropriate reports')) {
$roles_with_perm[] = $role
->id();
}
}
return $roles_with_perm;
}