Commit 9a696f34 authored by Florent Torregrosa's avatar Florent Torregrosa Committed by Florent Torregrosa
Browse files

Issue #3274248 by Grimreaper: Add permission to access the examples library

parent 0cddc078
Loading
Loading
Loading
Loading

ui_examples.install

0 → 100644
+20 −0
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Installation file for UI Examples module.
 */

declare(strict_types = 1);

/**
 * Add new permission to access the library to all roles.
 */
function ui_examples_update_8101(): void {
  $roles = \user_roles();
  if (!empty($roles)) {
    foreach (\array_keys($roles) as $rid) {
      \user_role_grant_permissions($rid, ['access_ui_examples_library']);
    }
  }
}
+2 −0
Original line number Diff line number Diff line
access_ui_examples_library:
  title: 'Access examples library'
+2 −4
Original line number Diff line number Diff line
@@ -4,8 +4,7 @@ ui_examples.overview:
    _controller: '\Drupal\ui_examples\Controller\ExamplesLibraryController::overview'
    _title: 'Examples library'
  requirements:
    # Currently no need to filter access on the example pages.
    _access: 'TRUE'
    _permission: 'access_ui_examples_library'

ui_examples.single:
  path: '/examples/{name}'
@@ -13,5 +12,4 @@ ui_examples.single:
    _controller: '\Drupal\ui_examples\Controller\ExamplesLibraryController::single'
    _title_callback: '\Drupal\ui_examples\Controller\ExamplesLibraryController::title'
  requirements:
    # Currently no need to filter access on the example pages.
    _access: 'TRUE'
    _permission: 'access_ui_examples_library'