Skip to content

Commit

Permalink
Added access check for page info.
Browse files Browse the repository at this point in the history
  • Loading branch information
kepol committed Jan 21, 2024
1 parent 525a7a2 commit 9889238
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public static function inList($item, array $list) {
*/
public static function getPageInfo(array $urls = NULL) : string {
try {
// Only allow administrators and content editors access.
$roles = ['administrator', 'content_editor', 'editor'];
if (empty(array_intersect($roles, \Drupal::currentUser()->getRoles()))) {
return '';
}

// Default to the current page.
if (!$urls) {
$urls = [self::getUrl()];
Expand Down

0 comments on commit 9889238

Please sign in to comment.