This adds a permission so that administration of the module can be delegated to specific roles.

Comments

heatherwoz created an issue. See original summary.

ramya balasubramanian’s picture

Assigned: Unassigned » ramya balasubramanian

Hey guys,
Currently working on this. Will post a patch soon

ramya balasubramanian’s picture

Hi guys,

Attached a Patch for this. Please have a look

ramya balasubramanian’s picture

Status: Active » Needs review

Sorry guys, ignore the last patch. Please see below snippet

We need to create flexible_google_cse.permissions.yml file in the module root folder. Place the below code

administer google_cse permission:
  title: 'Administer Google CSE'
  description: 'Allow access to google custom search engine'

Then in routing.yml file, add this custom permission

flexible_google_cse.flexible_search_controller_search:
  path: '/fgs-search'
  defaults:
    _controller: '\Drupal\flexible_google_cse\Controller\FlexibleSearchController::FgcsSearch'
    _title: 'Search'
  requirements:
    _permission: 'administer google_cse permission'
hunde.keba’s picture

Status: Needs review » Patch (to be ported)

The initial patch from @heatherwoz seems to be working fine for me. It looks like the patch was created on a windows machine and has some character encoding issue but, apart from that it is working fine. It will be ported to the latest dev branch.

  • heatherwoz authored f396b07 on 8.x-2.x
    Issue #3114413 by heatherwoz: Add custom permission for administering...
hunde.keba’s picture

The first patch by @heatherwoz was missing _permission key on the routing.yml file. Thank you @Ramya Balasubramanian for the fix. This will be ported on the next release.

heatherwoz’s picture

@hunde.keba, yes, sorry about the encoding issue. I realized after posting the patches that I hadn't encoded them correctly. Glad you were able to resolve it.

hunde.keba’s picture

Status: Patch (to be ported) » Fixed
hunde.keba’s picture

Version: 8.x-2.x-dev » 8.x-2.0-alpha1
hunde.keba’s picture

Status: Fixed » Closed (fixed)