You are here

class WebformOptionsCustomAccess in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_options_custom/src/Access/WebformOptionsCustomAccess.php \Drupal\webform_options_custom\Access\WebformOptionsCustomAccess

Defines the custom access control handler for the webform options custom entity.

Hierarchy

Expanded class hierarchy of WebformOptionsCustomAccess

File

modules/webform_options_custom/src/Access/WebformOptionsCustomAccess.php, line 12

Namespace

Drupal\webform_options_custom\Access
View source
class WebformOptionsCustomAccess {

  /**
   * Check that webform options custom source can be updated by a user.
   *
   * @param \Drupal\webform_options_custom\WebformOptionsCustomInterface $webform_options_custom
   *   A webform options custome entity.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Run access checks for this account.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public static function checkOptionsCustomSourceAccess(WebformOptionsCustomInterface $webform_options_custom, AccountInterface $account) {
    return $webform_options_custom
      ->access('update', $account, TRUE)
      ->andIf(AccessResult::allowedIfHasPermission($account, 'edit webform source'));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
WebformOptionsCustomAccess::checkOptionsCustomSourceAccess public static function Check that webform options custom source can be updated by a user.