You are here

public function Edit::isProtected in User protect 8

Checks if a given operation on an user should be protected.

Parameters

\Drupal\user\UserInterface $user: The user object to check access for.

string $op: The operation that is to be performed on $user.

\Drupal\Core\Session\AccountInterface $account: The account trying to access the entity.

Return value

bool TRUE if the operation should be protected. FALSE if the operation is not protected by this plugin.

Overrides UserProtectionBase::isProtected

File

src/Plugin/UserProtection/Edit.php, line 22

Class

Edit
Protects the user from being edited.

Namespace

Drupal\userprotect\Plugin\UserProtection

Code

public function isProtected(UserInterface $user, $op, AccountInterface $account) {
  if ($op == 'update') {
    return TRUE;
  }
  return parent::isProtected($user, $op, $account);
}