You are here

function skinr_ui_access in Skinr 8.2

Same name and namespace in other branches
  1. 7.2 skinr_ui.module \skinr_ui_access()

Determine whether the user has a given privilege.

Parameters

$string: The permission, such as "administer nodes", being checked for.

$account: (optional) The account to check, if not given use currently logged in user.

Return value

Boolean TRUE if the current user has the requested permission.

See also

user_access()

2 calls to skinr_ui_access()
SkinEditForm::form in skinr_ui/src/Form/SkinEditForm.php
Gets the actual form array to be built.
SkinsEditForm::buildForm in skinr_ui/src/Form/SkinsEditForm.php
Form constructor.

File

skinr_ui/skinr_ui.module, line 55
Handles Skinr UI functionality allowing users to apply skins to their site.

Code

function skinr_ui_access($string, \Drupal\Core\Session\AccountProxyInterface $account = NULL) {
  if (!isset($account)) {
    $account = \Drupal::currentUser();
  }
  return $account
    ->hasPermission($string) || $account
    ->hasPermission('administer skinr');
}