You are here

class YamlFormUiAccess in YAML Form 8

Defines the custom access control handler for the form UI.

Hierarchy

Expanded class hierarchy of YamlFormUiAccess

File

modules/yamlform_ui/src/Access/YamlFormUiAccess.php, line 13

Namespace

Drupal\yamlform_ui\Access
View source
class YamlFormUiAccess {

  /**
   * Check that form source can be updated by a user.
   *
   * @param \Drupal\yamlform\YamlFormInterface $yamlform
   *   A form.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Run access checks for this account.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public static function checkYamlFormSourceAccess(YamlFormInterface $yamlform, AccountInterface $account) {
    return AccessResult::allowedIf($yamlform
      ->access('update', $account) && $account
      ->hasPermission('edit yamlform source'));
  }

  /**
   * Check that form option source can be updated by a user.
   *
   * @param \Drupal\yamlform\YamlFormOptionsInterface $yamlform_options
   *   A form options entity.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Run access checks for this account.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public static function checkYamlFormOptionSourceAccess(YamlFormOptionsInterface $yamlform_options, AccountInterface $account) {
    return AccessResult::allowedIf($yamlform_options
      ->access('update', $account) && $account
      ->hasPermission('edit yamlform source'));
  }

  /**
   * Check that form can be updated by a user.
   *
   * @param \Drupal\yamlform\YamlFormInterface $yamlform
   *   A form.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Run access checks for this account.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public static function checkYamlFormEditAccess(YamlFormInterface $yamlform, AccountInterface $account) {
    return AccessResult::allowedIf($yamlform
      ->access('update', $account));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
YamlFormUiAccess::checkYamlFormEditAccess public static function Check that form can be updated by a user.
YamlFormUiAccess::checkYamlFormOptionSourceAccess public static function Check that form option source can be updated by a user.
YamlFormUiAccess::checkYamlFormSourceAccess public static function Check that form source can be updated by a user.