You are here

public function DefaultController::shurly_service_access_api_key in ShURLy 8

1 string reference to 'DefaultController::shurly_service_access_api_key'
shurly_service.routing.yml in shurly_service/shurly_service.routing.yml
shurly_service/shurly_service.routing.yml

File

shurly_service/src/Controller/DefaultController.php, line 13

Class

DefaultController
Default controller for the shurly_service module.

Namespace

Drupal\shurly_service\Controller

Code

public function shurly_service_access_api_key(AccountInterface $account) {
  if ($_REQUEST['apiKey']) {
    module_load_include('inc', 'shurly_service', 'shurly_api_keys');
    $api_validation = is_numeric(shurly_get_uid($_REQUEST['apiKey'])) ? TRUE : FALSE;
  }
  return \Drupal::currentUser()
    ->hasPermission('Create short URLs') && $api_validation;
}