You are here

interface UserProtectionInterface in User protect 8

Defines the interface for user protection plugins.

Hierarchy

Expanded class hierarchy of UserProtectionInterface

All classes that implement UserProtectionInterface

1 file declares its use of UserProtectionInterface
ProtectionRuleUnitTest.php in tests/src/Kernel/Entity/ProtectionRuleUnitTest.php

File

src/Plugin/UserProtection/UserProtectionInterface.php, line 15

Namespace

Drupal\userprotect\Plugin\UserProtection
View source
interface UserProtectionInterface extends PluginInspectionInterface, ConfigurableInterface, DependentPluginInterface {

  /**
   * Returns the user protection label.
   *
   * @return string
   *   The user protection label.
   */
  public function label();

  /**
   * Returns the description of the protection.
   *
   * @return string
   *   The user protection description.
   */
  public function description();

  /**
   * Returns the weight of the user protection.
   *
   * @return int
   *   The protections' weight.
   */
  public function getWeight();

  /**
   * Returns if plugin is enabled.
   *
   * @return bool
   *   TRUE if the plugin is enabled.
   *   FALSE otherwise.
   */
  public function isEnabled();

  /**
   * Checks if a given operation on an user should be protected.
   *
   * @param \Drupal\user\UserInterface $user
   *   The user object to check access for.
   * @param string $op
   *   The operation that is to be performed on $user.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The account trying to access the entity.
   *
   * @return bool
   *   TRUE if the operation should be protected.
   *   FALSE if the operation is not protected by this plugin.
   */
  public function isProtected(UserInterface $user, $op, AccountInterface $account);

  /**
   * Applies protections to user account form.
   *
   * @param array $form
   *   Nested array of form elements that comprise the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @return bool
   *   TRUE if the protection was applied.
   *   FALSE otherwise.
   */
  public function applyAccountFormProtection(array &$form, FormStateInterface $form_state);

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 11
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 12
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 12
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 19
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
UserProtectionInterface::applyAccountFormProtection public function Applies protections to user account form. 1
UserProtectionInterface::description public function Returns the description of the protection. 1
UserProtectionInterface::getWeight public function Returns the weight of the user protection. 1
UserProtectionInterface::isEnabled public function Returns if plugin is enabled. 1
UserProtectionInterface::isProtected public function Checks if a given operation on an user should be protected. 1
UserProtectionInterface::label public function Returns the user protection label. 1