You are here

protected function ErrorLevelConfigOverride::errorLevel in Error Level Permission 8

Get error level value depending on user permissions.

Return value

string The error level.

1 call to ErrorLevelConfigOverride::errorLevel()
ErrorLevelConfigOverride::loadOverrides in src/ErrorLevelConfigOverride.php
Returns config overrides.

File

src/ErrorLevelConfigOverride.php, line 28

Class

ErrorLevelConfigOverride

Namespace

Drupal\errorlevelpermission

Code

protected function errorLevel() {
  $currentUser = \Drupal::currentUser();
  if ($currentUser
    ->hasPermission('errorlevelpermission display verbose')) {
    return ERROR_REPORTING_DISPLAY_VERBOSE;
  }
  elseif ($currentUser
    ->hasPermission('errorlevelpermission display all')) {
    return ERROR_REPORTING_DISPLAY_ALL;
  }
  elseif ($currentUser
    ->hasPermission('errorlevelpermission display some')) {
    return ERROR_REPORTING_DISPLAY_SOME;
  }
  else {
    return ERROR_REPORTING_HIDE;
  }
}