You are here

public static function HtmlMailHelper::allowUserAccess in HTML Mail 8

Same name and namespace in other branches
  1. 8.3 src/Helper/HtmlMailHelper.php \Drupal\htmlmail\Helper\HtmlMailHelper::allowUserAccess()

Check if current user can see the option to receive only plain text mails.

Return value

bool FALSE if user do not have permission to change or administer users.

1 call to HtmlMailHelper::allowUserAccess()
htmlmail_form_user_form_alter in ./htmlmail.module
Implements hook_form_FORM_ID_alter().

File

src/Helper/HtmlMailHelper.php, line 108

Class

HtmlMailHelper
Class HtmlMailHelper.

Namespace

Drupal\htmlmail\Helper

Code

public static function allowUserAccess() {
  $user = Drupal::currentUser();
  return $user
    ->hasPermission('choose htmlmail_plaintext') || $user
    ->hasPermission('administer users');
}