You are here

UserPermissionsBase.php in JSON-RPC 8

File

modules/jsonrpc_core/src/Plugin/jsonrpc/Method/UserPermissionsBase.php
View source
<?php

namespace Drupal\jsonrpc_core\Plugin\jsonrpc\Method;

use Drupal\jsonrpc\Plugin\JsonRpcMethodBase;
use Drupal\user\PermissionHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Base method for methods that ned access to the user.permissions service.
 */
abstract class UserPermissionsBase extends JsonRpcMethodBase {

  /**
   * The permissions handler service.
   *
   * @var \Drupal\user\PermissionHandlerInterface
   */
  protected $permissions;

  /**
   * UserPermissions constructor.
   *
   * {@inheritdoc}
   */
  public function __construct(array $configuration, string $plugin_id, $plugin_definition, PermissionHandlerInterface $user_permissions) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->permissions = $user_permissions;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('user.permissions'));
  }

}

Classes

Namesort descending Description
UserPermissionsBase Base method for methods that ned access to the user.permissions service.